Grasshopper

algorithmic modeling for Rhino

I'm trying to create a routine that takes planar surfaces of various areas as inputs and produces a "lumpy" texture on each one. 

I'm doing this in the following way:

  1. create a random 2d distribution of points over each surface
  2. randomly displace each point in the direction normal to the surface
  3. patch the points for each surface
  4. trim each patch

I want the "lumps" to be about the same size for each surface, irrespective of that surface's size.

In an attempt to do this I've added logic to ensure that the density of 2d points on each surface is approximately the same. The problem I'm having is that the patch object doesn't "scale." That is, when presented of two surfaces of non-equal area but equal point density, "spans", and "flexibility," I get different "lump" sizes. (See attached image).

I'm wondering: does anyone know if there's a way for me to get the same lump sizes on surfaces of different areas? Like perhaps there is some way to scale the values passed to the "spans" or "flexibility" inputs of the patch object that would achieve this?

Many thanks!

P.S. Also attached gh file in the event that's helpful

Views: 861

Attachments:

Replies to This Discussion

I have what you want but is carried over solely via code (C#) this I guess that it could be totally useless to you.

Here's what you should do:

1. Forget patch.

2. Using the underlying surfaces of your "sheet" body Breps (i.e trimmed stuff == BrepFaces) divide them proportionally to the u/v domains using DeDom2Num: get Lists of U1/V1 values, say a uList and a vList. In order to do that:

3. Find the min of each List, say uMin, vMin.

4. Your U/V division integer values (per surface) are:

(int) (U * uList[i] / uMin)); (int) (V * vList[i] / vMin));

5. Using the pts and vectors trees from the divide surface component ... add to each div pt the corresponding normal vector multiplied by some min/max random value.

6. Create a Nurbs Surface using the newly created "distorted" pts (control points or trough points).

7. Trim the surfaces against the potential Inner/Outer loops (per brep). Trim requires solid cutters mind.

Thanks for the response.

The key bit seems to be step 6 -- what component what you use to create a surface from these newly created "distorted" points?

I don't use any component since as I said the whole thingy is carried over via code. 

But code actually means accessing some Method. In most of geometry related cases (Note: there's custom stuff written by David as well) that exactly do the GH components > in this occasion use Surface From Points.

BTW: with regard 3 (case :neg U0 values) find the min of the u/v domain(s) length.

BTW: Here's one (out of a zillion) reasons for NOT using patch (a helix "like" trimmed BrepFace == trimmed Surface, where patch ... well ... ). The "cutter" used to trim the "distorted" surface is displayed as red wireframe (for clarity).

BTW: NOT all the "distorted" surfaces need trim. If a given BrepFace "equals" the underlying Surface ... then no trim (a bit time consuming) is attempted. Other wise the "distorted" Surface is trimmed against a thickened (both sides at once) BrepFace acting as the "cutter" - so to speak. The thicken distance equals the max "distortion" random value PLUS some "safety net" value.

Not sure if the 1st Method mentioned is available as native component  mind (the 2nd is not - but in order to help you I could provide a small piece of code that allows you to prepare your "cutters" out of trimmed surfaces).

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service