Index: ps/trunk/source/simulation2/components/CCmpSelectable.cpp =================================================================== --- ps/trunk/source/simulation2/components/CCmpSelectable.cpp +++ ps/trunk/source/simulation2/components/CCmpSelectable.cpp @@ -505,13 +505,11 @@ else { const float radius = (buildingOverlay ? fpSize0_fixed.ToFloat() : overlayDescriptor->m_Radius) + overlay.m_Thickness / 3.f; - float stepAngle; - unsigned numSteps; - SimRender::AngularStepFromChordLen(TERRAIN_TILE_SIZE / 3.f, radius, stepAngle, numSteps); - for (unsigned i = 0; i < numSteps; ++i) + u32 numSteps = ceilf(float(2 * M_PI) * radius / (TERRAIN_TILE_SIZE / 3.f)); + for (u32 i = 0; i < numSteps; ++i) { - float angle = i * stepAngle; + float angle = i * float(2 * M_PI) / numSteps; float px = origin.X + radius * sinf(angle); float pz = origin.Y + radius * cosf(angle); Index: ps/trunk/source/simulation2/helpers/Geometry.h =================================================================== --- ps/trunk/source/simulation2/helpers/Geometry.h +++ ps/trunk/source/simulation2/helpers/Geometry.h @@ -91,15 +91,6 @@ CFixedVector2D NearestPointOnSquare(const CFixedVector2D& point, const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize); -/** - * Given a circle of radius @p radius, and a chord of length @p chordLength - * on this circle, computes the central angle formed by - * connecting the chord's endpoints to the center of the circle. - * - * @param radius Radius of the circle; must be strictly positive. - */ -float ChordToCentralAngle(const float chordLength, const float radius); - bool TestRaySquare(const CFixedVector2D& a, const CFixedVector2D& b, const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize); bool TestRayAASquare(const CFixedVector2D& a, const CFixedVector2D& b, const CFixedVector2D& halfSize); Index: ps/trunk/source/simulation2/helpers/Geometry.cpp =================================================================== --- ps/trunk/source/simulation2/helpers/Geometry.cpp +++ ps/trunk/source/simulation2/helpers/Geometry.cpp @@ -31,11 +31,6 @@ ); } -float Geometry::ChordToCentralAngle(const float chordLength, const float radius) -{ - return acosf(1.f - SQR(chordLength)/(2.f*SQR(radius))); // cfr. law of cosines -} - fixed Geometry::DistanceToSquare(const CFixedVector2D& point, const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize, bool countInsideAsZero) { /* Index: ps/trunk/source/simulation2/helpers/Render.h =================================================================== --- ps/trunk/source/simulation2/helpers/Render.h +++ ps/trunk/source/simulation2/helpers/Render.h @@ -180,20 +180,6 @@ const float dashLength, const float blankLength); /** - * Computes angular step parameters @p out_stepAngle and @p out_numSteps, given a @p maxChordLength on a circle of radius @p radius. - * The resulting values satisfy @p out_numSteps * @p out_stepAngle = 2*PI. - * - * This function is used to find the angular step parameters when drawing a circle outline approximated by several connected chords; - * it returns the step angle and number of steps such that the length of each resulting chord is less than or equal to @p maxChordLength. - * By stating that each chord cannot be longer than a particular length, a certain level of visual smoothness of the resulting circle - * outline can be guaranteed independently of the radius of the outline. - * - * @param radius Radius of the circle. Must be strictly positive. - * @param maxChordLength Desired maximum length of individual chords. Must be strictly positive. - */ -void AngularStepFromChordLen(const float maxChordLength, const float radius, float& out_stepAngle, unsigned& out_numSteps); - -/** * Subdivides a list of @p points into segments of maximum length @p maxSegmentLength that are of equal size between every two * control points. The resulting subdivided list of points is written back to @p points. * Index: ps/trunk/source/simulation2/helpers/Render.cpp =================================================================== --- ps/trunk/source/simulation2/helpers/Render.cpp +++ ps/trunk/source/simulation2/helpers/Render.cpp @@ -561,13 +561,6 @@ } -void SimRender::AngularStepFromChordLen(const float maxChordLength, const float radius, float& out_stepAngle, unsigned& out_numSteps) -{ - float maxAngle = Geometry::ChordToCentralAngle(maxChordLength, radius); - out_numSteps = ceilf(float(2*M_PI)/maxAngle); - out_stepAngle = float(2*M_PI)/out_numSteps; -} - // TODO: this serves a similar purpose to SplitLine above, but is more general. Also, SplitLine seems to be implemented more // efficiently, might be nice to take some cues from it void SimRender::SubdividePoints(std::vector& points, float maxSegmentLength, bool closed)