Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

RhinoCommon ClosedCurveOrientation() question

$
0
0

@Helvetosaur wrote:

If you draw a simple rectangle left to right on the top CPlane, then call the normal Rhino command Dir on it, the arrows should point in a counterclockwise direction (the sort of "standard" curve orientation as far as I can tell...)

Now if you run the following script on it, it will report "Clockwise"

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

def cp_crv_filt(rhino_object, geometry, component_index):
    return rs.IsCurvePlanar(geometry) and rs.IsCurveClosed(geometry)

msg="Select closed planar curve in Top view"
crvID=rs.GetObject(msg,4,preselect=True,custom_filter=cp_crv_filt)
crv=sc.doc.Objects.Find(crvID).Geometry
plane=rs.WorldXYPlane()
print crv.ClosedCurveOrientation(plane.Normal)

Now, this is comparing it with an "up" direction vector which is the normal of the world XY plane, which I consider to be "up "in this case. So why is it reporting clockwise and not CounterClockwise? Should I be standing on my head here? :stuck_out_tongue_closed_eyes:

Curve.ClosedCurveOrientation Method (Vector3d)   

Parameters    
upDirection
    Type: Rhino.Geometry.Vector3d
    A vector that is considered "up".    
Return Value
The orientation of this curve with respect to a defined up direction.

Thanks, --Mitch

Posts: 9

Participants: 5

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles