Grasshopper

algorithmic modeling for Rhino

Hi,

 

Trying to understand SDK:)

definition:

 


Public Shared Function CurveCurve ( _
curveA As Curve, _
curveB As Curve, _
tolerance As Double, _
overlapTolerance As Double _
) As CurveIntersections

What kind of data is CurveIntersections?
How can we use it?

Thanks to help!



Views: 2278

Replies to This Discussion

Hi RG,

 

CurveIntersections is a sort of collection containing IntersectionEvents.

 

You can follow the link you posted: CurveIntersections, then go to CurveIntersections Members. This shows that it is possible to index this class -- for example retrieve Item(0) -- as long as the index is less than Count. Each element we retrieve by indexing is an IntersectionEvent, that contains these members.

 

- Giulio
_______________

giulio@mcneel.com

McNeel Europe, Barcelona

Here's an example of code I use to get interection points of boxes along a line; a new box is created where the last one intersects:


// get the corners of the last box
Point3d[] boxCorners = element.GetCorners();
Point3d cuttingA = boxCorners [2];
Point3d cuttingB = boxCorners [3];

// create a line where the far box edge intersects my curve (it is extended to be sure it cuts the line)
LineCurve cuttingLine = new LineCurve(cuttingA, cuttingB);
boxEdgeExtended = cuttingLine.Extend(CurveEnd.Both, 10, CurveExtensionStyle.Line);


// calculate the intersection point
intersections = Rhino.Geometry.Intersect.Intersection.CurveCurve(curve, boxEdgeExtended, RhinoMath.SqrtEpsilon, RhinoMath.SqrtEpsilon);

// set the interection point as the start of the box
startPt = intersections[0].PointA;

.....

Just one (perhaps clumsy) way of using this class....
Cheers, Eirik

thanks for your help!!!!!

 

Best Regards,

RG

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service