mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 03:09:18 +02:00
Use the sq function to force constexpr expressions for numeric literals and enhance readability
This commit is contained in:
@@ -560,8 +560,8 @@ void TTrack::Load(cParser *parser, glm::dvec3 const &pOrigin)
|
||||
}
|
||||
|
||||
// length2 is better than length for comparing because it does not require sqrt function
|
||||
if( (glm::length2(( p1 + p1 + p2 ) / 3.0 - p1 - cp1) < 0.02 * 0.02)
|
||||
|| (glm::length2(( p1 + p2 + p2 ) / 3.0 - p2 + cp1) < 0.02 * 0.02) ) {
|
||||
if( (glm::length2(( p1 + p1 + p2 ) / 3.0 - p1 - cp1) < sq(0.02))
|
||||
|| (glm::length2(( p1 + p2 + p2 ) / 3.0 - p2 + cp1) < sq(0.02)) ) {
|
||||
// "prostowanie" prostych z kontrolnymi, dokładność 2cm
|
||||
cp1 = cp2 = glm::dvec3(0, 0, 0);
|
||||
}
|
||||
@@ -657,8 +657,8 @@ void TTrack::Load(cParser *parser, glm::dvec3 const &pOrigin)
|
||||
if( eType != tt_Cross ) {
|
||||
// dla skrzyżowań muszą być podane kontrolne
|
||||
// length2 is better than length for comparing because it does not require sqrt function
|
||||
if( (glm::length2(( p1 + p1 + p2 ) / 3.0 - p1 - cp1 ) < 0.02 * 0.02)
|
||||
|| (glm::length2(( p1 + p2 + p2 ) / 3.0 - p2 + cp1 ) < 0.02 * 0.02) ) {
|
||||
if( glm::length2(( p1 + p1 + p2 ) / 3.0 - p1 - cp1 ) < sq(0.02)
|
||||
|| glm::length2(( p1 + p2 + p2 ) / 3.0 - p2 + cp1 ) < sq(0.02) ) {
|
||||
// "prostowanie" prostych z kontrolnymi, dokładność 2cm
|
||||
cp1 = cp2 = glm::dvec3(0, 0, 0);
|
||||
}
|
||||
@@ -722,8 +722,8 @@ void TTrack::Load(cParser *parser, glm::dvec3 const &pOrigin)
|
||||
if( eType != tt_Cross ) {
|
||||
// dla skrzyżowań muszą być podane kontrolne
|
||||
// length2 is better than length for comparing because it does not require sqrt function
|
||||
if( (glm::length2(( p3 + p3 + p4 ) / 3.0 - p3 - cp3) < 0.02 * 0.02)
|
||||
|| (glm::length2(( p3 + p4 + p4 ) / 3.0 - p4 + cp3) < 0.02 * 0.02) ) {
|
||||
if( (glm::length2(( p3 + p3 + p4 ) / 3.0 - p3 - cp3) < sq(0.02))
|
||||
|| (glm::length2(( p3 + p4 + p4 ) / 3.0 - p4 + cp3) < sq(0.02)) ) {
|
||||
// "prostowanie" prostych z kontrolnymi, dokładność 2cm
|
||||
cp3 = cp4 = glm::dvec3(0, 0, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user