Grasshopper

algorithmic modeling for Rhino

I am attempting to determine whether a point is inside a closed curve or not.  Right now I'm inputting the area as a surface, converting it to a brep and testing for IsPointInside.  But the result is always coming back true... I am thinking this is possibly because I don't have a 3d brep?  Is there an easier way to go about this?

Thanks!

    - Brian -

Brian Lockyear
brian@lockyeardesign.com

Views: 6343

Replies to This Discussion

Hi Brian. Did you ever find a way?

 

I'm trying to get the curvature of a point on a curve, if this point is inside a given area.

 

It doesn't really seem to work? Where is my error?

 


private void RunScript(Curve curve, Surface surface, ref object A)
{
// border to check if inside
Brep border = Brep.CreateFromSurface(surface);

// return list
List
test = new List
();

// divide curve
double[] divisions = curve.DivideByCount(100, true);

for(int i = 0; i < divisions.Length; i++)
{
Point3d examine = curve.PointAt(divisions[i]);
Vector3d curvature = curve.CurvatureAt(divisions[i]);

if(border.IsPointInside(examine, RhinoMath.SqrtEpsilon, false))
test.Add(new Line(examine, curvature));

}
A = test;
}

 

Eirik Kjølsrud

when I read the SDK

Determine if a 3D point is inside of a brep. This function only makes sense for closed manifold Breps.


It seems as though this function might not be the correct one to determine whether a point is found on a surface? Any better?

Would the BrepEdge.Contains(Point3d) do the trick?

 

How to get from a surface to a BrepEdge then? ...

Assuming the point and the curve are on a 2d plane. Draw a line from the point in any direction, making sure it extends outside the boundary of the curve. Then count the number of times the line and the curve intersect. If the number of intersections is odd, then the point is inside the curve, if the number of intersections is even (or 0), then the point is outside the curve.

Hi,

You need to have a gap between the point and the brep, they can't do co-planar.

 

Regards,

Hello,


There is now the fonction " Containment" !

You can found it in Curve> analysis

Regards

fred

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service