Scaling concave shapes
9828 11 1- dagush
- 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.-
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
* skylineEngine project coordinator
* buildingEngine module developer
http//ggg.udg.edu/skylineEngine
- brianBurke
- Member
- 192 posts
- Joined: Nov. 2008
- Offline
- Platon
- Member
- 99 posts
- Joined: July 2007
- Offline
- Infernalspawn
- Member
- 229 posts
- Joined: May 2006
- Offline
- dagush
- 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.-
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
* skylineEngine project coordinator
* buildingEngine module developer
http//ggg.udg.edu/skylineEngine
- jacob clark
- 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
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
- tamte
- Member
- 8635 posts
- Joined: July 2007
- Offline
- dagush
- 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.-
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.-
————————-
* skylineEngine project coordinator
* buildingEngine module developer
http//ggg.udg.edu/skylineEngine
* skylineEngine project coordinator
* buildingEngine module developer
http//ggg.udg.edu/skylineEngine
- tamte
- Member
- 8635 posts
- Joined: July 2007
- Offline
- tamte
- Member
- 8635 posts
- Joined: July 2007
- Offline
- dagush
- Member
- 98 posts
- Joined: Sept. 2008
- Offline
- digitallysane
- Member
- 1192 posts
- Joined: July 2005
- Offline
-
- Quick Links