Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8993773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:16:10+00:00 2026-06-15T23:16:10+00:00

I need an algorithm to calculate the distribution of points on a spiral path.

  • 0

I need an algorithm to calculate the distribution of points on a spiral path.

The input parameters of this algorithm should be:

  • Width of the loop (distance from the innermost loop)
  • Fixed distance between the points
  • The number of points to draw

The spiral to draw is an archimedean spiral and the points obtained must be equidistant from each other.

The algorithm should print out the sequence of the Cartesian coordinates of single points, for example:

Point 1: (0.0)
Point 2: (…, …)
……..
Point N (…, …)

The programming language isn’t important and all help greatly appreciated!

EDIT:

I already get and modify this example from this site:

    //
//
// centerX-- X origin of the spiral.
// centerY-- Y origin of the spiral.
// radius--- Distance from origin to outer arm.
// sides---- Number of points or sides along the spiral's arm.
// coils---- Number of coils or full rotations. (Positive numbers spin clockwise, negative numbers spin counter-clockwise)
// rotation- Overall rotation of the spiral. ('0'=no rotation, '1'=360 degrees, '180/360'=180 degrees)
//
void SetBlockDisposition(float centerX, float centerY, float radius, float sides, float coils, float rotation)
{
    //
    // How far to step away from center for each side.
    var awayStep = radius/sides;
    //
    // How far to rotate around center for each side.
    var aroundStep = coils/sides;// 0 to 1 based.
    //
    // Convert aroundStep to radians.
    var aroundRadians = aroundStep * 2 * Mathf.PI;
    //
    // Convert rotation to radians.
    rotation *= 2 * Mathf.PI;
    //
    // For every side, step around and away from center.
    for(var i=1; i<=sides; i++){

        //
        // How far away from center
        var away = i * awayStep;
        //
        // How far around the center.
        var around = i * aroundRadians + rotation;
        //
        // Convert 'around' and 'away' to X and Y.
        var x = centerX + Mathf.Cos(around) * away;
        var y = centerY + Mathf.Sin(around) * away;
        //
        // Now that you know it, do it.

        DoSome(x,y);
    }
}

But the disposition of point is wrong, the points aren’t equidistant from each other.

Spiral with non equidistant distribution

The correct distribution example is is the image on the left:

Sirals

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:16:11+00:00Added an answer on June 15, 2026 at 11:16 pm

    To a first approximation – which is probably good enough for plotting blocks close enough – the spiral is a circle and increment the angle by the ratio chord / radius.

    // value of theta corresponding to end of last coil
    final double thetaMax = coils * 2 * Math.PI;
    
    // How far to step away from center for each side.
    final double awayStep = radius / thetaMax;
    
    // distance between points to plot
    final double chord = 10;
    
    DoSome ( centerX, centerY );
    
    // For every side, step around and away from center.
    // start at the angle corresponding to a distance of chord
    // away from centre.
    for ( double theta = chord / awayStep; theta <= thetaMax; ) {
        //
        // How far away from center
        double away = awayStep * theta;
        //
        // How far around the center.
        double around = theta + rotation;
        //
        // Convert 'around' and 'away' to X and Y.
        double x = centerX + Math.cos ( around ) * away;
        double y = centerY + Math.sin ( around ) * away;
        //
        // Now that you know it, do it.
        DoSome ( x, y );
    
        // to a first approximation, the points are on a circle
        // so the angle between them is chord/radius
        theta += chord / away;
    }
    

    10 coil spiral

    However, for a looser spiral you will have to solve the path distance more accurately as spaces too wide where the difference between away for successive points is significant compared with chord:
    1 coil spiral 1st approximation 1 coil spiral 2nd approximation

    The second version above uses a step based on solving for delta based on using the average radius for theta and theta+delta:

    // take theta2 = theta + delta and use average value of away
    // away2 = away + awayStep * delta 
    // delta = 2 * chord / ( away + away2 )
    // delta = 2 * chord / ( 2*away + awayStep * delta )
    // ( 2*away + awayStep * delta ) * delta = 2 * chord 
    // awayStep * delta ** 2 + 2*away * delta - 2 * chord = 0
    // plug into quadratic formula
    // a= awayStep; b = 2*away; c = -2*chord
    
    double delta = ( -2 * away + Math.sqrt ( 4 * away * away + 8 * awayStep * chord ) ) / ( 2 * awayStep );
    
    theta += delta;
    

    For even better results on a loose spiral, use a numeric iterative solution to find the value of delta where the calculated distance is within a suitable tolerance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to calculate the Delta-E distance between two colors. The algorithm to do
I need the perfect algorithm or C# function to calculate the difference (distance) between
Need a running (moving, rolling) average algorithm to calculate the 5-minute average bits that
I need the algorithm to animate the arrow based on 2 parameters, angle while
I need an recursive algorithm to calculate determinant of n*n matrix.
So, I have this algorithm to calculate cross-section of 3D shape with plane given
I need to calculate length of the object in a binary image (maximum distance
I need to calculate in hours how much time has elapsed from when a
I have a list of Vector3 points in c#, and I need to calculate
I need an efficient algorithm to calculate the result of multiplying 2 large numbers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.