Scaling concave shapes

   9828   11   1
User Avatar
Member
98 posts
Joined: Sept. 2008
Offline
Hi,

I'm having problems to “scale” a concave polygon. Let's say my polygon is L-shaped (or even worse). I need to reduce its size a little bit, but I need the resulting polygon to be INSIDE the original shape, and if I do a regular “scale” in a polyextrude the new polygon is smaller, but it gets out of the boundaries of the original shape. For a convex polygon a regular scale is ok, but not for a concave one.
I though I could use a combination of “ray” and “point” nodes to generate the normals along which to do the extrusion, but I can't get it working right.
Any ideas on how to do that scaling?

Thank you VERY much!!

cheers

dagush.-
————————-
* skylineEngine project coordinator
* buildingEngine module developer
http//ggg.udg.edu/skylineEngine
User Avatar
Member
192 posts
Joined: Nov. 2008
Offline
Hi dagush. There's a VOP that does exactly what you're trying to do - Displace Along Normal. If you set the displacement amount to a negative number, you'll erode in your shape.

Attachments:
displacealongnormal.hip (55.0 KB)

User Avatar
Member
99 posts
Joined: July 2007
Offline
dagush
Hi,

I'm having problems to “scale” a concave polygon. Let's say my polygon is L-shaped (or even worse). I need to reduce its size a little bit, but I need the resulting polygon to be INSIDE the original shape, …
Any ideas on how to do that scaling?

try using “inset” instead of scale
User Avatar
Member
229 posts
Joined: May 2006
Offline
if you have normals you can use the peak-sop.

Seb
User Avatar
Member
98 posts
Joined: Sept. 2008
Offline
Hi,

Thank you VERY much for your answers. I've been trying all solutions, the solution using Displace Along Normal, the “inset” and the one using peak, but they do not work for my perticular case. Ayway, I think the solution is the Displace Along Normal, but, basically, the problem now comes from the fact I (still) don't have normals I'm working with 2D polygons I generated with some Python code, which defines 2D blocks from a vector-based city map representation. At the end, I plan to plug this code into the rest of our urbanEngine project. To generate the block geometry, I used the explanations (and the code) in

http//www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=11472&highlight=python+geometry [http]

So, now, the problem is how to add the exterior normal for every vertex, so that the displacement will work properly… I should keep thinking on this…

thank you all for your answers!!! You are a GREAT help!!!

cheers

dagush.-
————————-
* skylineEngine project coordinator
* buildingEngine module developer
http//ggg.udg.edu/skylineEngine
User Avatar
Member
665 posts
Joined: July 2005
Offline
Hi Dagush,

If I understand correctly you need some outward facing normals.

The dead simplest way to this, but not accurate at all, is to subtract the Point position from the centroid of the object.


A more accurate trick is to polyextrude your face up, then take the normals from the extruded surface, and apply those back to your mesh.

Hope this helps!


cheers,
-j
User Avatar
Member
8635 posts
Joined: July 2007
Offline
inset should do what you want, either in polyextrude or starburst SOP
if not, then you can at least use it to generate normals for your method
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
98 posts
Joined: Sept. 2008
Offline
Hi,

Here you have an example of what I'm trying to do. Node HOM_Geo is the result of some new algorithm we're testing, and is supposed to be a set of city blocks. But I have to reduce the blocks a little bit to leave some room for the street itself. I tried a direct polyextrude scale, but you can see that we have some VERY concave polygons that generated an unusable result. Then I tried what you suggested, and I got to this

1- I added a delete operator to eliminate an undesired polygon (I'll check the code to see why it is there)
2- I used a polyextrude to generate the normals for the block edges
3- I plugged the VopSop as shown by brianBurke
4- I added a point op to flatten the result. I don't know why, but the resulting polys were slightly bended upwards…
5- I deleted the side faces from the polyextrude above…

I think I'm doing too many operations here, but, at least, I have a working solution. Probably, I'll try to generate the normals directly along with the geometry, inside the HOM_Geo node, and avoid a few steps…

THANK YOU ALL FOR YOUR INVALUABLE HELP!!!!

cheers

dagush.-

Attachments:
test blocks.hipnc (58.9 KB)

————————-
* skylineEngine project coordinator
* buildingEngine module developer
http//ggg.udg.edu/skylineEngine
User Avatar
Member
8635 posts
Joined: July 2007
Offline
here is the inset method if anyone is interested (or if you want streets of constant width)

Attachments:
test_blocks_inset.hipnc (62.3 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
8635 posts
Joined: July 2007
Offline
or here is the method of using inset to compute normals
if you want uneven width streets

Attachments:
test_blocks_inset_uneven.hipnc (73.6 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
98 posts
Joined: Sept. 2008
Offline
That's it!!
It is simple PERFECT!
When I tried the inset, I testet too large values! Now, it works perfectly!

thanks!!!

cheers

dagush.-
————————-
* skylineEngine project coordinator
* buildingEngine module developer
http//ggg.udg.edu/skylineEngine
User Avatar
Member
1192 posts
Joined: July 2005
Offline
Haven't checked the files sent by others, but as a general thing I find the PolyFrame SOP very useful for generating various useful vectors which can eventually be copied into N with an Attribute SOP and then used for Displace along normal, Peak, PolyExtrudes etc.

Dragos
Dragos Stefan
producer + director @ www.dsg.ro
www.dragosstefan.ro
  • Quick Links