[drape] Fix sqrt constexpr

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-10-29 10:00:40 +00:00
parent 12b9504daa
commit 210b4df8b2
6 changed files with 9 additions and 9 deletions

View File

@@ -118,7 +118,7 @@ void ColoredSymbolShape::Draw(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::
pixelSize = m2::PointU(2 * static_cast<uint32_t>(m_params.m_radiusInPixels),
2 * static_cast<uint32_t>(m_params.m_radiusInPixels));
// Here we use an equilateral triangle to render circle (incircle of a triangle).
static float constexpr kSqrt3 = static_cast<float>(sqrt(3.0f));
static float constexpr kSqrt3 = 1.732050808f;
float r = m_params.m_radiusInPixels - m_params.m_outlineWidth;
V::TTexCoord uv2(uv.x, uv.y, norm(0.0, 0.0));
@@ -195,7 +195,7 @@ void ColoredSymbolShape::Draw(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::
}
// Here we use an right triangle to render a quarter of circle.
static float constexpr kSqrt2 = static_cast<float>(sqrt(2.0f));
static float constexpr kSqrt2 = 1.414213562f;
float r = m_params.m_radiusInPixels - m_params.m_outlineWidth;
V::TTexCoord uv2(uv.x, uv.y, norm(-halfWidthBody, halfHeightBody));
buffer.push_back(V(position, V::TNormal(0.0, 0.0, r, 0.0f), uv2));

View File

@@ -198,7 +198,7 @@ private:
void CreateRoundCap(glsl::vec2 const & pos)
{
// Here we use an equilateral triangle to render circle (incircle of a triangle).
static float constexpr kSqrt3 = sqrt(3.0f);
static float constexpr kSqrt3 = 1.732050808f;
float const radius = GetHalfWidth();
m_capGeometry.emplace_back(CapVertex::TPosition(pos, m_params.m_depth),

View File

@@ -11,8 +11,8 @@ namespace df
namespace
{
double constexpr kValidPathSplineTurn = 15 * math::pi / 180;
double constexpr kCosTurn = cos(kValidPathSplineTurn);
double constexpr kSinTurn = sin(kValidPathSplineTurn);
double constexpr kCosTurn = 0.999989561; // cos(kValidPathSplineTurn)
double constexpr kSinTurn = 0.004569245; // sin(kValidPathSplineTurn)
double constexpr kRoundStep = 23;
int constexpr kMaxStepsCount = 7;

View File

@@ -382,8 +382,8 @@ void RouteShape::PrepareMarkersGeometry(std::vector<SubrouteMarker> const & mark
{
ASSERT(!markers.empty(), ());
static float constexpr kSqrt3 = sqrt(3.0f);
static float constexpr kSqrt2 = sqrt(2.0f);
static float constexpr kSqrt3 = 1.732050808f;
static float constexpr kSqrt2 = 1.414213562f;
static float constexpr kInnerRadius = 0.6f;
static float constexpr kOuterRadius = 1.0f;

View File

@@ -101,7 +101,7 @@ void SubmitCircleStaticVertices(RoadClass roadClass, glsl::vec3 const & pivot, g
glsl::vec2 const & uv, std::vector<TrafficCircleStaticVertex> & circlesGeometry)
{
// Here we use an equilateral triangle to render circle (incircle of a triangle).
static float constexpr kSqrt3 = sqrt(3.0f);
static float constexpr kSqrt3 = 1.732050808f;
auto const p = glsl::vec4(pivot, static_cast<float>(roadClass));
circlesGeometry.emplace_back(p, glsl::vec4(rightNormal, -kSqrt3, -1.0f), uv);
circlesGeometry.emplace_back(p, glsl::vec4(rightNormal, kSqrt3, -1.0f), uv);

View File

@@ -118,7 +118,7 @@ void GenerateLineCaps(ref_ptr<dp::GraphicsContext> context, std::vector<SchemeSe
for (auto const & segment : segments)
{
// Here we use an equilateral triangle to render a circle (incircle of a triangle).
static float constexpr kSqrt3 = sqrt(3.0f);
static float constexpr kSqrt3 = 1.732050808f;
auto const offset = lineOffset * segment.m_rightNormal;
auto const pivot = glsl::vec3(segment.m_p2, depth);