algorithmic modeling for Rhino
Hi Sander,
Brep.DuplicateVertices()
It creates a point array. There is no direct access to the vertices at present.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Is there any documentation on how to use this? I'm already stuck trying to get the Duplicate vertices into an array and loop it.
What I want to do is loop through the vertices of a brep and do an inclusion test with some other breps.
My goal is to make a more efficient inclusion test: instead of testing every point with every possible brep I want to do this one vertex of a brep at a time and stop the loop when one of the vertices is within a brep.
DuplicateVertices returns an array of Point3d structs. So if you want to loop over these points, you'll need to do something like:
For Each vertex As Point3d in myBrep.DuplicateVertices()
'Do something with the vertex.
Next
To make it a bit less fuzzy, you could also store the vertices in a dedicated variable first:
Dim vertices As Point3d() = myBrep.DuplicateVertices()
For i As Int32 = 0 To vertices.Count - 1
'Do something with vertices(i)
Next
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Great It works! I managed to speed up the process by a lot!
I'll try to clean up the scripts and post them. Might be useful to others.
Out of curiosity, what are you trying to speed up exactly?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
How about you test the BoundingBoxes of Set A and B for intersections first? BoundingBoxes are cached and it's very easy (and fast) to test for intersections.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
That is exactly what I'm working right know. After that I also want to integrate the physical intersection test so that the loop will also stop when a intersection is detected.
Take object from set A
Test for BBox intersection
Test for point inside
Test for physical intersection.
Another possible speed-up, though this one might not be measurable. You could 'sort' the order of intersections with all breps in set B from nearest to furthest. This way hopefully any intersections will happen early in the loop and you can abort quicker. There's a method on BoundingBox called ClosestPoint(), which should allow you to quickly compute the distance between the center of every brep in Set A and the bounding boxes of all breps in set B.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by