

On 05/26/2016 11:56 AM, Le_Forgeron wrote:
> Le 26/05/2016 00:53, Jim Holsenback a écrit :
>
> Thanks for your time :)
>
> I'm going to be painful, hopefully not to much for Jim, but other(s):
>
> what is "clockwise" and "counterClockwise" ?
>
> And before someone jumps in to state the obvious, think again about it.
>
> Usually (Danger Will Robinson, Danger), +X is to the right and +Y is up.
>
> And the direction of Z when going 3D is a holy war between lefthand and righthand
system.
>
> But it is not unusual either that +X is to the right and +Y is down (many pictures
format have such convention).
> (origin at top left, and in fact, westerntext has that same convention: Nth lines,
Mth character on that line)
>
> And some tenants of righthand system like +X to the left, +Y up and +Z away (and
most 3D formats are rather righthanded... at least STL is strongly thought as such)
>
> I also want to stress that it is topologically, and logically too, impossible to
define left/right with an alien over a radio link: even using physical laws to have
the same experiment. You can define down and up (gravity is helpful), you can define
away and nearer, but,
> as the alien's environment might be matter or antimatter, you cannot use anything
to provide the same definition of left & right.
> And if you cannot define left/right, clockwise and counterclockwise are lost too.
>
> All this, to ask for more explanation, or illustration, of "clockwise" and
"counterClockwise".
>
I'm not opposed to making things clearer. I was aiming for wording I
thought most would easily understand, while conforming somewhat to
conventions.
The clockwise vs counterclockwise concept is used commonly for 2D
geometric algorithms and the lathe and prism spline point lists are 2D.
In the case of the lathe we are working in a normally defined x,y plane.
In the case of prisms we are working in a normally defined x,z plane.
There are different ways to make the determination, but for splines
which form closed loop(s), a counterclockwise loop would be one such
that the sum over all the loop edges of (x2x1)*(y2+y1) is negative.
Points inside a counterclockwise loop of edges are considered to be
inside the shape. A clockwise loop reverses the points to shape
relationship.
In the case of lathes we can have edge(s) which do not form a closed
loop. There we chose a point (x3,y3) to the left of an edge and look at
the determinant (cross product) :
(x2x1)*(y3y1)(y2y1)*(x3x1).
If the value returned is >0, the 'edgebydirection' is
counterclockwise with respect to the test point and the test point is
considered to be inside. If <0 the test point is considered outside. If
exactly 0, the test point is collinear with the edge.
POVRay today follows the above clockwise vs counterclockwise 2D
conventions for determining inside vs outside everywhere except for the
bezier spline in the prism, where, the inside and outside conventions
are reversed for the prism sides. Further, all prism ends point outward
no matter the loop order.
Asides: There are degenerate, fringe point lists which will also fall
outside these 2D conventions, but I think users will not often deal with
them. The 2d clockwise vs counterclockwise conventions are used mostly
with what is our linear spline. Of course for prisms replace y with z in
the equations above.
So, I guess the question is do we:
 add some or all the text above about 2d clockwise / counterclockwise
conventions?
 add some figures explicitly showing the two example point lists or
others showing what would be clockwise and counterclockwise point lists
with respect to inside/outside determination?
 change to more generic wording like 'orientation' and 'reverse
orientation' without any suggestions about normal, normal directions but
noting they flip.
 simply note that point list order matters to surface normal
determination in lathes and prisms and leave it at that? Starting to
feel like I have wandered off into the weeds... :)
Thoughts?
Bill P.
Post a reply to this message

