POV-Ray : Newsgroups : povray.general : plane through 4 points Server Time: 27 Jun 2019 05:02:15 GMT
 plane through 4 points (Message 1 to 8 of 8)
 From: folkert Subject: plane through 4 points Date: 30 May 2019 18:55:06 Message:
```Hi,

I would like to render a plane through 4 3D points.
How can I do so?
E.g. a plane but, as it are 3D points, it should bend where required.

regards
```
 From: Bald Eagle Subject: Re: plane through 4 points Date: 31 May 2019 00:45:01 Message:
```"folkert" <fol### [at] vanheusdencom> wrote:
> Hi,
>
> I would like to render a plane through 4 3D points.
> How can I do so?
> E.g. a plane but, as it are 3D points, it should bend where required.
>
>
> regards

Well, you can "easily" create a plane that passes through 3 points.
http://news.povray.org/povray.binaries.images/message/%3Cweb.5880fc4d1652a4dcc437ac910%40news.povray.org%3E/#%3Cweb.588
0fc4d1652a4dcc437ac910%40news.povray.org%3E

If you want a curved sheet that passes through 4 points, then you'd have to
specify how that curved sheet passes through them.  any one of the 4 points
could be the "odd one out" - which then specifies the direction of the curving.

I guess with some vector math you could do something along the lines of
projecting that point onto the plane defined by the other 3 points, find one of
the 3 different centers of the triangle defined by those 3 points, and use the
center, the projected point, and the odd point out to define a spline / curve.

I just did a huge amount of work a while back to get multiple bezier patches
that pass through defined points - so that's what I'm thinking is a way.

Maybe there's a way to do it with a function / isosurface or parametric.

Actually, I was just playing with making a sheet with a prism, and found that
you can make "linear" prisms that will give you that.

So maybe a prism would be simplest.
```
 From: Le Forgeron Subject: Re: plane through 4 points Date: 31 May 2019 12:18:34 Message: <5cf11b9a\$1@news.povray.org>
```Le 30/05/2019 Ã  20:52, folkert a Ã©critÂ :
>
> Hi,
>
> I would like to render a plane through 4 3D points.
> How can I do so?
> E.g. a plane but, as it are 3D points, it should bend where required.
>
>
> regards
>
>

Any 4 3D points ?

Let's imagine they are disposed as the vertices of tetrahedron
(regular), what would be the right (curved) sheet ?
(I'm questionning the "bend where required" part, which seems obvious
but is really not that obvious at all )

Can we assume that somehow the 4 points are ordered ?

Does the sheet have to be infinite ? (that's what a plane is)
or limited to the 4 points ?

If you have 4 points, can you interpolate some additional ones to use a
bicubic patch ?
http://wiki.povray.org/content/Reference:Bicubic_Patch
```
 From: Bald Eagle Subject: Re: plane through 4 points Date: 31 May 2019 17:55:07 Message:
```Le_Forgeron <jgr### [at] freefr> wrote:

> Any 4 3D points ?

I guess that would be the obvious assumption - to code for the general case.

> Let's imagine they are disposed as the vertices of tetrahedron
> (regular), what would be the right (curved) sheet ?
> (I'm questionning the "bend where required" part, which seems obvious
> but is really not that obvious at all )

Right - they'd have to be specified.  I read this to mean that there would be a
simple single bend in the sheet, rather than a saddle or other complex shape.
So then I suppose if two triangles shared a face and they were non-planar, then
the sheet would pass through the unshared vertex of the first triangle, then
through the shared edge / vertices, and then "bend where required to make it
pass through the final unshared vertex.

> Can we assume that somehow the 4 points are ordered ?

We could, but it would probably be easier to just code it, and have the user
order them according to how they fit into the code.

> Does the sheet have to be infinite ? (that's what a plane is)
> or limited to the 4 points ?
>
> If you have 4 points, can you interpolate some additional ones to use a
> bicubic patch ?
> http://wiki.povray.org/content/Reference:Bicubic_Patch

And THAT sounds like a simple proposition, however remember that the points
specified for making a Bezier patch are only control points - the patch doesn't
pass through them.  And that's what took me far, far, far longer to work out -
and I only managed to do so with much help from TOK and clipka.

I have most of what I think should do the trick worked out, I just need to
"capture" the angles used by Reorient_Trans () or another function / macro so
that I can then undo the rotations later.

Here's what I'm doing so far:
3 points are used to calculate the centroid of that triangle (I have no error /
colinear / sanity checking)
The 4th is the point that will get curved through.
The 4th point is projected onto the plane that the triangle is in.
The vectors from that projected point extended back through both the centroid
and 4th point are used to define 2 control points for a cubic spline.

Since I have no idea where the points are in space, I
1. translate everything as a group so one control point is at the origin.
2. rotate everything so that the other control point is on the x-axis.
3  rotate the points on the rest of the "curve" so they are in the x-z plane.

Then I can declare a proper prism, using the x,z coordinates of the original 3
points (2 of which should now be coincident) and the 4th point.

(I hope I'm visualizing this correctly so far)
The prism should pass through all the non-control points, which are the original
4 points.

Then I just undo the rotations and translation of the prism, and that should be
what the OP wanted...
```
 From: Alain Subject: Re: plane through 4 points Date: 31 May 2019 18:42:35 Message: <5cf1759b\$1@news.povray.org>
```Le 19-05-30 Ã  14:52, folkert a Ã©critÂ :
>
> Hi,
>
> I would like to render a plane through 4 3D points.
> How can I do so?
> E.g. a plane but, as it are 3D points, it should bend where required.
>
>
> regards
>
>

By definition, a plane don't bend as it have zero curvature everywhere.

Next, if the points are not co-planar, you can't know witch one is the
outlier. Using 4 non co-planar points, you can define 4 different planes.

It can look like a bent surface (curvature of zero), a saddle-like
surface (negative curvature), or a dome (positive curvature).

Sorry, but there is no generic solution.
```
 From: Le Forgeron Subject: Re: plane through 4 points Date: 1 Jun 2019 08:32:56 Message: <5cf23838\$1@news.povray.org>
```Le 31/05/2019 Ã  19:50, Bald Eagle a Ã©critÂ :
>
> Le_Forgeron <jgr### [at] freefr> wrote:
>
>> Any 4 3D points ?
>
> I guess that would be the obvious assumption - to code for the general case.
>
>> Let's imagine they are disposed as the vertices of tetrahedron
>> (regular), what would be the right (curved) sheet ?
>> (I'm questionning the "bend where required" part, which seems obvious
>> but is really not that obvious at all )
>
> Right - they'd have to be specified.  I read this to mean that there would be a
> simple single bend in the sheet, rather than a saddle or other complex shape.
> So then I suppose if two triangles shared a face and they were non-planar, then
> the sheet would pass through the unshared vertex of the first triangle, then
> through the shared edge / vertices, and then "bend where required to make it
> pass through the final unshared vertex.
>
>> Can we assume that somehow the 4 points are ordered ?
>
> We could, but it would probably be easier to just code it, and have the user
> order them according to how they fit into the code.
>
>> Does the sheet have to be infinite ? (that's what a plane is)
>> or limited to the 4 points ?
>>
>> If you have 4 points, can you interpolate some additional ones to use a
>> bicubic patch ?
>> http://wiki.povray.org/content/Reference:Bicubic_Patch
>
>
> And THAT sounds like a simple proposition, however remember that the points
> specified for making a Bezier patch are only control points - the patch doesn't
> pass through them.  And that's what took me far, far, far longer to work out -
> and I only managed to do so with much help from TOK and clipka.
>

Ok, then I have a simpler solution, but not without my extension:

a Nurbs of size 2 , hence also of order 2.

Nurbs points need a weight (fourth coordinate) but it's easy to use the
same weight (1) for all 4 3D points.

The perimeter is A-B-D-C-A, update for your own 4 points.

#declare A =<0, 0, 0, 1>;
#declare B =<3, 0, 0, 1>;
#declare C =<0, 3, 0, 1>;
#declare D =<2, 2, 1, 1>;
#declare UVMeshableObject = nurbs { 2, 2, 2, 2
0, 0, 1, 1
0, 0, 1, 1
A B
C D
}
#declare Texture = texture { checker texture { pigment { color blue 1 }
} texture { pigment { color rgb <1,1,0> } } }

#include "NurbsMesh.inc"
#declare UResolution = 32;
#declare VResolution = 32;
mesh {
UVMeshable( UVMeshableObject, UResolution, VResolution )
texture { uv_mapping Texture scale <1/24, 1/24, 1> }
}
```

Attachments:

Preview of image 'four.png'

 From: Bald Eagle Subject: Re: plane through 4 points Date: 1 Jun 2019 13:05:00 Message:
```Le_Forgeron <jgr### [at] freefr> wrote:

> Ok, then I have a simpler solution, but not without my extension:

Yes, it's definitely tricky to try to take a sheet (OP's "bent plane") and
orient it properly with the points lying in the plane.   Especially if the
points aren't somehow axis-aligned --- without a lot of analytical geometry and
jumping through hoops.

Looking at the Bezier patches again, the 4 corners are coincident with the
surface, so maybe generate a spline that could be "extruded" into a curved
"plane" and just use a series of edge-to-edge Bezier patches that follow the
spline.

I may have something workable as well which would give a very large background
area (I'm just assuming that's what he wants) and maybe for what he needs it
will be "close enough".  I think I need to sort the 3 points used to find the
centroid based on distance from where the 4th point gets projected onto that
plane, but maybe that can just be done by hand as a one-off solution.
Basically an inverse prism - a hollow rounded-square tube in solid space.
(*)

I'm wondering though if there's a polynomial shape or something that would take
the coordinates of the 4 (ordered) points as arguments.  That would be elegant.

Also, I recall clipka repeatedly stating how "trivial" it would be to make a
fillet between two surfaces if they were meshes.  Maybe that's a way to go.

And now that I've gotten this far (only 1/2 a cup of coffee in, folks!) maybe we
can just blob together two isosurface planes.

*And now, just writing that about the tube - one should be able to take a box,
and align a face of it with 3 of the points, and then just slide it over so that
another face is coincident with the 4th.  Then you could use an inverse rounded
box.
```
 From: Bald Eagle Subject: Re: plane through 4 points Date: 2 Jun 2019 00:25:00 Message:
```"Bald Eagle" <cre### [at] netscapenet> wrote:
maybe we
> can just blob together two isosurface planes.

Yep, that works.  It's not plug-and-play level, but it works for the simple
points that I started with.  I'll play a bit more and post in pbi.
```