Here is a script that fills a flat contour with a net of squares.
Here is a testing .blend file…
Script is ALMOST done - Im publishing its version 0.9.0 just get some C&C and ideas how to finalise it.
The script works with a mesh which is only a flat contour - a ring of verts lying in one and the same geometric plane.
What script does? -
For each contour selected:
- Makes a grid (NET) with appropriate size and using dX,dY… dX = dY = 0.5 (so far)
- Makes the necessary additional edges to cover the area of contour and covers it with faces
So far it is implemented in two different meshes (objects).
Here it is in pictures:
an interface to set-up parameters
Join the two meshes/objects so that faces REALLY cover the contour
Optimise the script where possible so pls dont criticise the algoritm… Any ideas for optimisation are welcome though
It covers badly loooong & tiny parts of contour that go outwards. The tiny parts that go inwards are processed with a nice cuts of the NET
Example of the problem which is only theoretical cause while making a contour for terrains - it is quite rate that it has comb-like edges at one or more of its sections):
I’ve put a lot of effort to cover this type of sharp sections up to 1 times dX,dY… I thought it will work for N-times but… :evilgrin:
- Script works with contours that are NOT rotated. If the contour is rotated, a problems appears that two meshes cannot get sinhronized at location I think something like this shall be used at the end of processing:
LX = LX+minX*math.cos(RY) LY = LY+minY*math.cos(RX) LZ = LZ-minX*math.sin(RY)+minY*math.sin(RX) ob_Grid.setLocation(LX,LY,LZ) ob_Grid.rot = ob.rot ob_Grid.size = ob.size
It works perfect for rotation and size, but NOT for location! It is like this cause while making the second mesh (the NET) I use origin = minX,minY of the first one. Therefore, since the script works with local coordinates, if the original contour is rotated on X,Y and/or Z, some modification of NET location shall be done. BUT I want able to figure it our so far and my mind already has blocked soooo PLEASE, PLEASE, PLEASE… help on that relatively minor issue but an important one!!!
Thanks in advance!