I have some quadrilateral (4 points) facets that I want to force to be planar - how can I calculate the closest planar face of the non-planar geometry? What algorithm should I look for?

1

Loading...

Move this topic

1

An algorithm off the top of my head: take three points out of four. Compute the distance of the fourth point from the plane formed by the three points. Repeat, leaving a different point each time. Take the plane with the smallest distance.

There might be more efficient algorithms, I don't know.

There might be more efficient algorithms, I don't know.

Leave a comment on PhiLho's reply

Hi

phi.lho responded while I was drawing these. Mustn't let them go to waste though!

Ah, and I realise that I haven't answered exactly what you've asked. So, er, find the midpoint of the four points by adding the x, y and z co-ordinates and dividing by four. The plane must go through that midpoint. Can you see me waving my hands showing the next stage? I need to think how to formalise it ...

string

Leave a comment on allonestring's reply

Leave a comment on allonestring's reply

Ah, indeed, "closest planar face" might not include the points at all... It depends on exact needs.

Leave a comment on PhiLho's reply

You need an optimization algorithm such as Simplex, since this is a minimization problem.

s, t are scalars. For simplicity we can assume them being = 1.

Your four facet vertices
__f__
_{1},
__f__
_{2},
__f__
_{3},
__f__
_{4} need to have minimum distance to
__p__ (being unknown), which means that the sum of the squared distances must be minimal:

R = sum{i = 1...4} (
__f__
_{i} -
__p__)
^{^2} = minimal

This is the equation to be solved. So, for p you have

p
_{0x} v
_{1x} v
_{2x}

p
_{0z} v
_{1z} v
_{2z}

with the individual components p
_{0x},p
_{0y},....v
_{2y},v
_{2z} as unknowns (i.e. you have 12 knowns with your 4 vertices and 9 unknowns for your plane).

For the optimization algorithm, you specify a good initial guess for
__p__, e.g. something like

0 1
0

0 0
0

and calculate R. The optimization algorithm then varies your unknowns so that R is minimized.

A simple algorithm (which however, depending on your start value and the form of the R landscape might use a lot of optimization steps) is Simplex (do a search for Simplex + Java + algorithm). More complicated algorithms use gradients or the Hessian matrix and may converge faster, but for the low dimensionality of your problem (only 4 points in 3 dimensions) might be overkill.

When you have a optimized parameters for the equation for
__p__, you then can calculate the projection of the facet vertices on the plane.

(Comment: In Edit mode, the message shows sub- and superscripts, but when published, unfortunately it does not!).

Leave a comment on mbraendle's reply

thanks to everybody for the very useful advice!

I think Im overlooking something. Take a look at this pic

Each of the faces of the hexagons are not perfectly planar. My idea was to run an aglorithm to each of those faces. Would in this manner the topology be saved?

Leave a comment on proce55ing's reply

From the picture it is not clear to me whether the honeycomb is bent or not. If it is not and the walls are running all in z direction, then it is very easy - you just take the arithmetic mean of the x/y coordinates of two adjacent corners of a facet.

If however the honeycomb is bent, you should tell more about how it is created.

Leave a comment on mbraendle's reply

Hi

Thinking that the honeycomb does look bent, as if it's draped over a curved surface, I have another observation and another question:

• you will no longer have a regular tesselation

• are you hoping that the edges of each hexagon will fit nicely against its neighbours - like on a football (I know that they use a mixture of pentagons and hexagons); or is it intended to be a higgledy-piggledy surface like badly-laid paving slabs? This will affect your original question

string

Leave a comment on allonestring's reply

what do you mean by "bent"?

each hex cell has 12 points - 6 define the base , they stay fixed. The other 6 defining the "height" of my cell - can move in x,y and z position - hence the 4 sided face you see are not perfectly planar.

havent tried a method yet - the Simplex algorithm suggested by
mbraendle seems interesting - but I might be happy with any other method as long as the faces of my hex cell stays planar and each hexagon edges

fit to its neighbours.

allonestring

-yes - grid is not regular on purpose and that is fine

- answered other issue above.

Leave a comment on proce55ing's reply

i think you're going to be out of luck getting all your hexagons planar - too many shared points. if one hexagon is planar then it dictates the orientation of its neighbours. 3 points define a plane so those other 3 points that make up a hex are dictated.

i think, but can't prove mathematically, that the only way for all the hexagons to be planar is for them all to be in the same plane. there's no way to fold a hexagonal grid (which is effectively what you're trying to do). even a square grid is very limited in how you can fold it - the moment you start making folds across you can't make folds in the other direction. a zig zag is the best you can achieve.

i think, but can't prove mathematically, that the only way for all the hexagons to be planar is for them all to be in the same plane. there's no way to fold a hexagonal grid (which is effectively what you're trying to do). even a square grid is very limited in how you can fold it - the moment you start making folds across you can't make folds in the other direction. a zig zag is the best you can achieve.

Leave a comment on kooogy's reply

If you want to have a bent surface with regular hexagons you need sometimes to insert a pentagon. See geodesic domes by Buckminster Fuller.

However, as you explained, one side of the tubes is flat, whereas the other side is defined by non-parallel cuts to the xy plane.

So all walls could be simply perpendicular to your xy plane. This means that your algorithm must be rewritten so that the height (or z coordinate) of your upper face varies, but the x and y coordinates are the same as those of the corners of the lower hexagons, i.e. don't allow to vary the x and y coordinates, only the z.

Leave a comment on mbraendle's reply

thnaks you all again for useful advice.

I think there are two options at this point

1) triangulate faces - but this will double the number of panels my structure if made of (yes potentially Im looking to fabricate it)

2) as mbrandle said - rewrite algorithm to allow changes only in z dir

3) find out a way to first calculate triangles, then work out a planar face passing throug them and use new calculate points as input for neighbours hexagons. Probably in this manner I should be able to keep connectivity of edges - wha do you think?

Leave a comment on proce55ing's reply

Hi

I think that it all hinges on hinges.

Would it help to approach it from this direction? You start with your planes hinged to the hexagons' edges and rotate them about those hinges until you get the right result at their tops?

string

Leave a comment on allonestring's reply

hi allonestring,

Im not sure I got fully what you mean.

So I have a my 3D hex grid has base point that stay always fixed (the base is a regular hex grid) , the top grid is irregular. each point of the top grid is connected to those of the base grid. Hence for each 4 sided panel two points lie on the base grid and stay fixed. The other two are free to move in xyz directions. I dont understand how thinking about hinges cant solve the problem to have planar faces. I get a planar face then I dont quite understand how you think I could solve the problem of edges connectivity?

Leave a comment on proce55ing's reply

Change topic type

Link this topic

Provide the permalink of a topic that is related to this topic

Reply to proce55ing's question

{"z4085862":[25080000001066059,25080000001066096],"z4102052":[25080000001065850],"z5977540":[25080000001066063,25080000001066094,25080000001066191,25080000001065974],"z5312986":[25080000001066048,25080000001064146,25080000001064200,25080000001066216,25080000001065982],"z4210336":[25080000001066098,25080000001066179,25080000001064204]}

**14**Replies**1310**Views**1**Followers