Arraying circles with varying radii along a curve

Hello!
I am trying to array circles with 3 different radii randomly along a curve but I haven’t been having any luck.
I started by trying with the divide distance as that would allow me to set a base diameter for each circle but the divide distance applies the different distances simultaniously, so it ends up dividing the curve multiple times.

Here is a picture of what I am trying to achieve (sorry for the bad drawing)
The circles should be tangent to eachother.

I have tried that solution but it doesn’t seem to be working, as I am not trying to move the circles manually. I want to divide a line with the distances of the diameter and then divide those diametres into the circle radii.
I have found another workaround, that does not guarantee the tangency of the circles but seem close enough for me at least:

This is the result of what I did:

Why not posting your script with the curve internalized ?
I am sure someone will provide you a working script.
I did that by code


disanceOnCurves_LEGACY.gh (9.4 KB)

  private void RunScript(Curve curve, List<double> radiuses, ref object A)
  {

    //Calculate the center of circles with specified radius on a curve
    List<Point3d> lst_points = new List<Point3d>();
    Point3d pointOnCurve = CurveCircleIntersection(curve, curve.PointAtStart, radiuses[0]);
    lst_points.Add(pointOnCurve);

    for (int i = 1; i < radiuses.Count; i++)
    {
      double radius = (radiuses[i - 1] + radiuses[i] );
      Point3d pointOnCurveNew = CurveCircleIntersection(curve, pointOnCurve, radius);
      if (pointOnCurveNew != Point3d.Unset)
      {
        pointOnCurve = pointOnCurveNew;
        lst_points.Add(pointOnCurve);
      }
      else
      {
        break;
      }
    }

    A = lst_points;
  }

  // <Custom additional code> 

  /// <summary>
  /// Calculate the point on a curve that is at a certain radius from a point
  /// this point must be after the previous point
  /// </summary>
  /// <param name="curve">The curve</param>
  /// <param name="point">The point on the curve</param>
  /// <param name="radius">The radius at which the new pointt must be from previous point</param>
  /// <returns>Next point, Point3d.Unset if no point found</returns>
  Point3d CurveCircleIntersection(Curve curve, Point3d point, double radius)
  {
    double tolerance = 0.0001;
    double overlapTolerance = 0.0001;

    Point3d output = Point3d.Unset;
    double t = double.NaN;
    curve.ClosestPoint(point, out t);

    if (t != double.NaN)
    {
      Circle circle = new Circle(Plane.WorldXY, point, radius);
      CurveIntersections ci = Rhino.Geometry.Intersect.Intersection.CurveCurve(curve, new ArcCurve(circle), tolerance, overlapTolerance);

      double tMinOK = double.NaN;



      foreach (IntersectionEvent ie in ci)
      {
        if (ie.ParameterA > t)
        {
          //First parameter that is OK
          if (Double.IsNaN(tMinOK))
          {
            tMinOK = ie.ParameterA;
            output = ie.PointA;
          }
          else
          {
            //If a parameter is nearer
            if (ie.ParameterA < tMinOK)
            {
              tMinOK = ie.ParameterA;
              output = ie.PointA;
            }
          }
        }
      }
    }
    return output;
  }

Look at plugins for Jewels, Peacock, …
See these threads

6 Likes

If you want aligned circles on the curve like this , they must intersected

The script @laurent_delrieu posted above does work without intersections - the circle centers lie on the curve, not the points of contact between the circles.

2 Likes

Yes, i said “like this” as shown in the picture

Sorry - didn’t mean to suggest you’d not understood, just highlighting the difference for other readers.

Do not be sorry, i understand you and the original question should be clearer

1 Like

Using a mesh with an image to calculate a radius with a brightness, so all circles are tangents and here are on a spiral
SCARLETT JOHANSSON BY LEETA HARDING


Joconde


With Hilbert Curve

Andy Warhol’s Marilyn Monroe

10 Likes

I said sorry for the bad drawing and stated I wanted the circles tangent to eachother.
How clearer should I be?

Thank you! your replies have been very helpful!
I will take a look at these topics.

Questions will not be clearer with “sorry”
If you don’t accept the solution of @laurent_delrieu , what you want?

I said sorry and clarified what I wanted.
What more do you want then?
Can you be clearer on how should I be clearer in my question?

I havent accepted the solution yet because I haven’t had the chance to test the solutions out.
Once I find a suiting solution I will mark this as solved.

If you don’t want to help you can refrain from replying. I didn’t ask you personally for a solution, you don’t need to act offended when someone doesn’t think your solution works for their needs.

I think this would be a great solution.
Do you know what script was used for this?

I think it was not your question. So the question for this thread seems to be answered on discussion n°4.

For image technique see this thread

2 Likes

Thank you!