The zero point of circles changes with their orientation
-
![A FollowMe construction connecting the "zero points" of an array of circles.](/uploads/imported_attachments/m55j_zero-point-connections.jpg "A FollowMe construction connecting the "zero points" of an array of circles.")
I'm not sure how describe this problem. I've done a lot of poring through the Plugins forum searching on "circle". Searching on [0][0] wasn't getting me anywhere.
I am trying to connect a smooth path between "corresponding" points on an array of circles.
For each circle, I find what I call the zero point, the starting point of the first edge in the circle.
... create a circle ...
zeropoint = circle[0][0]Putting all of those zero points into an array, making a curve from that, and using that as the path for .followme, results in the image attached.
As you can see in the image, there are three places where the "zero point" on some of the circles is a bit discontinuous from the adjacent circles.
Obviously this is an effect of how SketchUp creates the circles. There is no parameter for where the starting point of a circle is, SU just uses the center, the normal direction, and the radius. It has some internal algorithm, presumably based on the normal angle, for where it starts the circle. And for a sequence of circles that twists around like this, sometimes that products glitches.
So here's the question: Does anyone have any ideas for how to generate a "smooth path" through "corresponding" points on all of these circles?
One approach that I have come up with is this:
- I got to the current point from a previous point. Perhaps I presume that I can start with two zero points to get
going. - There is a vector from the previous point to the current point.
- To whatever points on the next circle that I might connect with, there will be another vector.
- I pick whatever point on the next circle gives me the minimum angle
between those two vectors.
Does that make sense? Anyone have ideas for a simpler method?
Thanks,
August - I got to the current point from a previous point. Perhaps I presume that I can start with two zero points to get
-
P.S. If anyone has a better term for the starting point of the first edge than "zero point", I'll happily use it.
-
@august said:
P.S. If anyone has a better term for the starting point of the first edge than "zero point", I'll happily use it.
Well let us see what the API docs say:
@unknownuser said:
](http://www.sketchup.com/intl/en/developer/docs/ourdoc/arccurve#start_angle) documentation":5dfj7d1v]
ArcCurve.start_angle
The start_angle method is used to retrieve the angle of the start of the arc,
measured from the X axis in radians. -
Thanks Dan,
That's a angle, not a point, but it may turn out to be useful. Thanks for the pointer (no pun intended). I'll bang around on it for a bit over the next couple of days.
As for terminology in the broad sense, I suppose that following the above lead I would call my "zero point" the "start_point" for the circle. But if there's nothing standardized, then
zero_point = circle[0][0]
still has an appeal.August
-
@august said:
That's a angle, not a point, but it may turn out to be useful.
I changed the text by underlining part of it, to give you a clue.
Basically it means the start point will lie on the local x axis.
Since a circle is a
ArcCurve
, "under the hood", and anArcCurve
is a subclass ofCurve
, there should be several ways of getting the start point.circle[0].curve.first_edge.start.position
circle[0].curve.vertices[0].start.position
Because
circle
is an array of edges returned froments.add_circle
, get any one of the edge members.edge.curve
returns theCurve
orArcCurve
object that an edge belongs to.curve.first_edge
returns the curve's first edge, no kidding..edge.start
returns the starting vertex.vertex.position
returns aGeom::Point3d
equivalent for the vertex. -
Hi Dan,
Thanks for a pretty amazing exploration of the possibilities. It's both educational and entertaining (for those of us who like this kind of thing).
My apologies for dropping the ball on getting back to you. This is one of those projects that I just keep whittling away at because each step seems a little more complex than I had expected or was ready to deal with.
You provided quite an array of methods for finding the starting angle of a circle, and I'm sure some of those will be useful as I move forward.
As for my current stuck spot, I think what I'm really trying to figure out is how to specify the starting angle of a circle, a polygon, or a curve, relative to the previously placed circle or polygon, as I go around the knot placing circles.
When I use the usual tools to create a circle, the starting angle does not seem to be a parameter that is under my control. The image at the top of this thread shows where it defaults to, just using the standard circle-creating functions. I do not need to understand the logic behind those defaults, because that's not going to help me with my actual problem.
If I create a polygon, like a circle, I also do not know how to specify a starting angle.
I have to wonder, when you draw a circle or a polygon manually in SU, the point you drag out from the center becomes the starting angle. So what's going on under the hood? Is a default circle being generated and then rotated so that it's starting angle is where the cursor is?
Lacking that methodology, the only way I can see to create either a circle or a polygon where I get to specify the staring angle is to make a 360 degree curve. That feels unnecessarily limiting, but that's where I've gotten to.
My current thinking on my original problem is that I need to figure out how to place the new curve, based on the information I have from the previous circle/curve. I have the normal, which is derived from the current segment of the knot curve. I have the previous circle/curve. And I have the previous circle/curve's starting angle.
And, as you suggested, I have to deal with what the starting angle is relative to.
I have to figure out what starting angle I want to specify, based on the previous normal, the previous starting angle, and the current normal.
I think I'm going to have to nudge the starting angle of the next successive circle by just a little, so that as the sequence progresses around the knot, it does a slow rotation and comes back to the beginning. Does it want to go around only once? Or three times for the three lobes of this knot? Or what?
You gave me a great nudge that percolated for a while and now I think I know what I need to figure out for my next step. I hope that's not another year, but who knows?
Anyway, thanks for all the tips.
August
Advertisement