Grasshopper

algorithmic modeling for Rhino

so on - I can convert surface into intervals for random U and V coordinates, but how to merje them into uv parameter to evaluate on surface? It is much more easy ro make this in the volume (box) becouse those parameters are independent in that case

Views: 2811

Replies to This Discussion

Why don't you just generate two streams of random numbers (use two similar Random components but with a different seed value), convert those numbers into points using PointXYZ and then feed those points into the SurfaceEvaluate component? If you make sure that the Random domain is the same as the surface domain, you should get random points on the surface.

The density of random points will be affected by the density of the surface isocurves. Placing random points without using UV space requires a different algorithm. Not that much harder to make, but a lot slower to run.

--
David Rutten
david@mcneel.com
Seattle, WA
Is there a simple way to essentially perform that same thing but within the confines of a 3d volume? basically trying to great a number of random points within a box or volume rather than on a surface.

I've just tried this. Occasionally, points end up outside the surface - could this have something to do with trimming? Is there a workaround? I cannot figure out how to test if the point is contained within the surface using python.

Thanks

For BrepFaces you can test whether a UV point is on or off the trim domain. However when you convert a BrepFace to a Surface you lose the trimming information, so it's important to maintain the original BrepFace.

--

David Rutten

david@mcneel.com

EDIT: Got it working now, Thanks.

For anyone else reading this, I used rhinoscriptsyntax.IsPointOnSurface

--------

Whoa. I didn't even know there was a separate type called Brepface. How might I perform that test?

I'm trying to place a point on a surface that is beyond some distance from two other sets of points on the surface.

Here's what I'm working with so far:

def ThrowDart(ListA, DistA, ListB, DistB, Surf_id):
     Done = False
     Uspan = rs.SurfaceDomain(Surf_id,0)
     Vspan = rs.SurfaceDomain(Surf_id,1)
     while not Done:
          UVCoords = [random.uniform(Uspan[0],Uspan[1]),random.uniform(Vspan[0],Vspan[1])]
          Eval = rs.EvaluateSurface(Surf_id,UVCoords[0],UVCoords[1])
          NewPt = Rhino.Geometry.Point3d(Eval)
          # Some kind of surface-region containment test here?

          # test for Distance from ListA and ListB points here

Thanks again for your help. It's been a few months since I've looked at any of this stuff, unfortunately, so I'm out of practice. My eventual goal is to make a GH component that will perform leaf veination type stuff.

Ok, python isn't my strong suit, but it looks like you're trying to use RhinoScript like methods in python. There may be a method for testing whether a UV point is on a brepface, I do not know what it is called if it exists.

I can show you how to do this in C# (see attached).

--

David Rutten

david@mcneel.com

Attachments:

Thank you!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service