# Span an area between 3 points

17 messages
Open this post in threaded view
|

## Span an area between 3 points

Open this post in threaded view
|

## Re: Span an area between 3 points

Open this post in threaded view
|

## Re: Span an area between 3 points

Open this post in threaded view
|

## Re: Span an area between 3 points

 In reply to this post by nophead nophead wrote > Euler rotations always confuse me so I did it with Frenet-Seret style > vector maths. Seems to work. Yes, works fine! Your great, many thanks for your quick response.  This really brings me a giant step forward my targets. Now I only have to understand your magic code. I will come back soon with some fine measure modules Regards -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Span an area between 3 points

Open this post in threaded view
|

## Re: Span an area between 3 points

Open this post in threaded view
|

## Re: Span an area between 3 points

 In reply to this post by nophead On 2020-10-31 12:47, nop head wrote: > Euler rotations always confuse me so I did it with Frenet-Seret style > vector maths. Seems to work. Why such complicated approach? What is wrong with simply adding the vector to the two points to obtain the rectangle area? Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Span an area between 3 points

 It isn't a rectangle, it is a parallelogram with sheared text on it. On Sat, 31 Oct 2020 at 12:49, <[hidden email]> wrote:On 2020-10-31 12:47, nop head wrote: > Euler rotations always confuse me so I did it with Frenet-Seret style > vector maths. Seems to work. Why such complicated approach? What is wrong with simply adding the vector to the two points to obtain the rectangle area? Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Span an area between 3 points

 On 2020-10-31 13:51, nop head wrote: > It isn't a rectangle, it is a parallelogram with sheared text on it. My question still stands if it is a parallelogram Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Span an area between 3 points

 So what is your solution to construct a transform to rotate and shear a plane to align with an arbitrary parallelogram?On Sat, 31 Oct 2020 at 12:56, <[hidden email]> wrote:On 2020-10-31 13:51, nop head wrote: > It isn't a rectangle, it is a parallelogram with sheared text on it. My question still stands if it is a parallelogram Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Span an area between 3 points

 On 2020-10-31 13:58, nop head wrote: > So what is your solution to construct a transform to rotate and shear > a plane to align with an arbitrary parallelogram? The problem was presented with this illustration http://forum.openscad.org/file/t2988/span-area.jpgAs far as I can tell you can do exactly what the figure indicates, add the vector d to each point to arrive at the parallelogram. But maybe I am missing something? Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Span an area between 3 points

 Yes it would be easy to calculate the forth vector to complete the polygon but then how do you draw it with text, which are 2D operations operating in the XY plane?  On Sat, 31 Oct 2020 at 13:05, <[hidden email]> wrote:On 2020-10-31 13:58, nop head wrote: > So what is your solution to construct a transform to rotate and shear > a plane to align with an arbitrary parallelogram? The problem was presented with this illustration http://forum.openscad.org/file/t2988/span-area.jpg As far as I can tell you can do exactly what the figure indicates, add the vector d to each point to arrive at the parallelogram. But maybe I am missing something? Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Span an area between 3 points

 On 2020-10-31 14:10, nop head wrote: > Yes it would be easy to calculate the forth vector to complete the > polygon but then how do you draw it with text, which are 2D operations > operating in the XY plane? I have not studied the details, but obviously you can compute the plane equation from 3 points.  Or even simpler, create a vector from P1 to P2 and compute a couple of cross products (the first with vector d) to arrive at the 3 first columns of the transformation matrix. The fourth is simply choosing an origin. So I thing you can transform the text with the resulting matrix. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Span an area between 3 points

 That is pretty much exactly what I did. On Sat, 31 Oct 2020 at 13:22, <[hidden email]> wrote:On 2020-10-31 14:10, nop head wrote: > Yes it would be easy to calculate the forth vector to complete the > polygon but then how do you draw it with text, which are 2D operations > operating in the XY plane? I have not studied the details, but obviously you can compute the plane equation from 3 points.  Or even simpler, create a vector from P1 to P2 and compute a couple of cross products (the first with vector d) to arrive at the 3 first columns of the transformation matrix. The fourth is simply choosing an origin. So I thing you can transform the text with the resulting matrix. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Span an area between 3 points

 Here is a simpler version. Instead of computing the shear and applying it I simply set up the X and Y axes along the edges of the parallelogram and make Z orthogonal to both with a cross product.module fill(p1,p2,d){    // this is the vector    v=p2-p1;        // length of vector    l=norm(v);        // length of d    h=norm(d);       x = unit(v);    y = unit(d);    z = unit(cross(v, d));    m = [[x.x, y.x, z.x, p1.x],         [x.y, y.y, z.y, p1.y],         [x.z, y.z, z.z, p1.z],         [0,   0,   0,   1   ]];              multmatrix(m) area(l,h,"p1","p2","p1+d","p2+d");}On Sat, 31 Oct 2020 at 13:37, nop head <[hidden email]> wrote:That is pretty much exactly what I did. On Sat, 31 Oct 2020 at 13:22, <[hidden email]> wrote:On 2020-10-31 14:10, nop head wrote: > Yes it would be easy to calculate the forth vector to complete the > polygon but then how do you draw it with text, which are 2D operations > operating in the XY plane? I have not studied the details, but obviously you can compute the plane equation from 3 points.  Or even simpler, create a vector from P1 to P2 and compute a couple of cross products (the first with vector d) to arrive at the 3 first columns of the transformation matrix. The fourth is simply choosing an origin. So I thing you can transform the text with the resulting matrix. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org