discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] 3d hull() with 2d primitives needed!

U
ufomorace
Wed, Oct 28, 2015 9:56 AM

I just found out extrusion of a loop using hull. It's very cool. Openscad is
so awesome, that 3 lines can litteraly make a polygon extrusion code which
took me 2 days to code in triangles arrays.

So, the hull can't handle 2d polygons. Damn, it processes twice as many
vertices, yes it's kindof slow.

So the solution would be to take the polygons, and generate a new set of
quads joining every 2 points in the polygon. perhaps is possible. will see.
it's the best solution currently.

--
View this message in context: http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14235.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I just found out extrusion of a loop using hull. It's very cool. Openscad is so awesome, that 3 lines can litteraly make a polygon extrusion code which took me 2 days to code in triangles arrays. So, the hull can't handle 2d polygons. Damn, it processes twice as many vertices, yes it's kindof slow. So the solution would be to take the polygons, and generate a new set of quads joining every 2 points in the polygon. perhaps is possible. will see. it's the best solution currently. -- View this message in context: http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14235.html Sent from the OpenSCAD mailing list archive at Nabble.com.
U
ufomorace
Wed, Oct 28, 2015 10:08 AM

Ok, so some digging around has revealed a gem called runsun's faces.scad
toolkit with chain polygons module...

Chain takes a set of polygons and chains them togeter same as extrude. it's
exactly what we need.

I'm checking out how easy it is to take an array of matrix positions of
cubes, and use squares instead to extrude that. Not that trivial, however
someone with a less zombie brain than me can probably figure out the handles
to change the array of polygons into an array of multimatrix rotations. hm.
cool code. it's here:

https://raw.githubusercontent.com/runsun/faces.scad/master/faces.scad

--
View this message in context: http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14237.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ok, so some digging around has revealed a gem called runsun's faces.scad toolkit with chain polygons module... Chain takes a set of polygons and chains them togeter same as extrude. it's exactly what we need. I'm checking out how easy it is to take an array of matrix positions of cubes, and use squares instead to extrude that. Not that trivial, however someone with a less zombie brain than me can probably figure out the handles to change the array of polygons into an array of multimatrix rotations. hm. cool code. it's here: https://raw.githubusercontent.com/runsun/faces.scad/master/faces.scad -- View this message in context: http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14237.html Sent from the OpenSCAD mailing list archive at Nabble.com.
V
vicnet
Tue, Nov 3, 2015 8:22 PM

I check the code and currently, only 2d vector is used for hull if the first
children is a 2D primitive, even if the 2D primitive is transform and not
more in XY plane.
For example:

The second circle is no more in XY plane.
It has 3D coordinates (display is fine) but only [x,y] is used, like a
projection, in hull.
Why ?

A 2D primitive that is no more in XY plane should be used as a 3D in hull or
other built-in modules.

You could also use linerar_extrude(0.1) <2D primitive>(...) to get a thin 3D
object from 2D primitive.

Rq: projection(cut = false) rotate([45,0,0]) circle2(5); do nothing

a+
Vicnet

--
View this message in context: http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14276.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I check the code and currently, only 2d vector is used for hull if the first children is a 2D primitive, even if the 2D primitive is transform and not more in XY plane. For example: The second circle is no more in XY plane. It has 3D coordinates (display is fine) but only [x,y] is used, like a projection, in hull. Why ? A 2D primitive that is no more in XY plane should be used as a 3D in hull or other built-in modules. You could also use linerar_extrude(0.1) <2D primitive>(...) to get a thin 3D object from 2D primitive. Rq: projection(cut = false) rotate([45,0,0]) circle2(5); do nothing a+ Vicnet -- View this message in context: http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14276.html Sent from the OpenSCAD mailing list archive at Nabble.com.
W
wolf
Fri, Nov 6, 2015 7:56 PM

This code creates an ellipsoid out of individual triangles - not those 2D
primitives you find described in the manual, as these are not compatible
with CGAL in a 3D environment. Rather, my 2D primitives use an undocumented
property of polyhedron().

I'll leave the comments in, this is experimental and unfinished code . . .
http://forum.openscad.org/file/n14292/Ellipsoid.ellipsoid  When finished,
I intend to submit the code to the team to be implemented as a variant of
surface(). That should improve rendering speed, which is rather slow
currently.

Wolf

a=30;  b=20;  c=10;    //half-axes of ellipse
Step=10;
StartVal_u=0;  EndVal_u=360;    // 10 seconds, 1224 facets, 614 vertices, 2
volumes
StartVal_v=0;  EndVal_v=180;
//StartVal_u=10;  EndVal_u=360;    // 10 seconds, 1190 facets, 614
vertices, 1 volumes
//StartVal_v=0;  EndVal_v=180;

//scale([a,b,c])    sphere(1,$fn=51);      // used in debugging

for (v=[StartVal_v+Step/2:Step:EndVal_v])  for
(u=[StartVal_u+Step/2:Step:EndVal_u])  SurfaceElement(u,v);

module SurfaceElement(u,v)
{ Center=P(u,v);                    // centre vector for SurfaceElement()
P0=P(u-Step/2,v-Step/2);          // corner vector for SurfaceElement()
P1=P(u+Step/2,v-Step/2);          // corner vector for SurfaceElement()
P2=P(u+Step/2,v+Step/2);          // corner vector for SurfaceElement()
P3=P(u-Step/2,v+Step/2);          // corner vector for SurfaceElement()
//  translate(Center)    color("magenta")  cube([.3,.3,.3], center=true);
// used in debugging
//    translate(P0)        color("red")      cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P1)        color("white")    cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P2)        color("green")    cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P3)        color("yellow")    cube([.3,.3,.03],
center=true);  // used in debugging
//    polygon(P0,P1,P2);  // accepts only 2-vectors
//    polygon(P0,P2,P3);  // accepts only 2-vectors
if(P0 != P1 && P1 != P2)  color("red")    polyhedron
(points=[P0,P1,P2], faces=[[0,1,2]]);
if(P0 != P2 && P2 != P3)  color("yellow")  polyhedron
(points=[P0,P2,P3], faces=[[0,1,2]]);
// CGAL does'nt like degenerate faces!
//  polyhedron (points=[P0,P1,P2,P3], faces=[[0,1,2,3]]);  // non-planar
face, CGAl complains
//  echo(u-Step/2,u+Step/2,v-Step/2,v+Step/2,P0,P1,P2,P3,Center);
}

function P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)];  //point on
the surface of an ellipsoid

--
View this message in context: http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14292.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

This code creates an ellipsoid out of individual triangles - not those 2D primitives you find described in the manual, as these are not compatible with CGAL in a 3D environment. Rather, my 2D primitives use an undocumented property of polyhedron(). I'll leave the comments in, this is experimental and unfinished code . . . <http://forum.openscad.org/file/n14292/Ellipsoid.ellipsoid> When finished, I intend to submit the code to the team to be implemented as a variant of surface(). That should improve rendering speed, which is rather slow currently. Wolf a=30; b=20; c=10; //half-axes of ellipse Step=10; StartVal_u=0; EndVal_u=360; // 10 seconds, 1224 facets, 614 vertices, 2 volumes StartVal_v=0; EndVal_v=180; //StartVal_u=10; EndVal_u=360; // 10 seconds, 1190 facets, 614 vertices, 1 volumes //StartVal_v=0; EndVal_v=180; //scale([a,b,c]) sphere(1,$fn=51); // used in debugging for (v=[StartVal_v+Step/2:Step:EndVal_v]) for (u=[StartVal_u+Step/2:Step:EndVal_u]) SurfaceElement(u,v); module SurfaceElement(u,v) { Center=P(u,v); // centre vector for SurfaceElement() P0=P(u-Step/2,v-Step/2); // corner vector for SurfaceElement() P1=P(u+Step/2,v-Step/2); // corner vector for SurfaceElement() P2=P(u+Step/2,v+Step/2); // corner vector for SurfaceElement() P3=P(u-Step/2,v+Step/2); // corner vector for SurfaceElement() // translate(Center) color("magenta") cube([.3,.3,.3], center=true); // used in debugging // translate(P0) color("red") cube([.3,.3,.03], center=true); // used in debugging // translate(P1) color("white") cube([.3,.3,.03], center=true); // used in debugging // translate(P2) color("green") cube([.3,.3,.03], center=true); // used in debugging // translate(P3) color("yellow") cube([.3,.3,.03], center=true); // used in debugging // polygon(P0,P1,P2); // accepts only 2-vectors // polygon(P0,P2,P3); // accepts only 2-vectors if(P0 != P1 && P1 != P2) color("red") polyhedron (points=[P0,P1,P2], faces=[[0,1,2]]); if(P0 != P2 && P2 != P3) color("yellow") polyhedron (points=[P0,P2,P3], faces=[[0,1,2]]); // CGAL does'nt like degenerate faces! // polyhedron (points=[P0,P1,P2,P3], faces=[[0,1,2,3]]); // non-planar face, CGAl complains // echo(u-Step/2,u+Step/2,v-Step/2,v+Step/2,P0,P1,P2,P3,Center); } function P(u,v)=[a*cos(u)*sin(v),b*sin(u)*sin(v),c*cos(v)]; //point on the surface of an ellipsoid -- View this message in context: http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14292.html Sent from the OpenSCAD mailing list archive at Nabble.com.
PF
Peter Falke
Sun, Nov 8, 2015 3:03 PM

Hi Wolf: nice work. If I remember correctly this was not allowed in older
versions.

Why dont you remove the debugging and and post your code into a new thread?

2015-11-06 20:56 GMT+01:00 wolf wv99999@gmail.com:

This code creates an ellipsoid out of individual triangles - not those 2D
primitives you find described in the manual, as these are not compatible
with CGAL in a 3D environment. Rather, my 2D primitives use an undocumented
property of polyhedron().

I'll leave the comments in, this is experimental and unfinished code . . .
http://forum.openscad.org/file/n14292/Ellipsoid.ellipsoid  When
finished,
I intend to submit the code to the team to be implemented as a variant of
surface(). That should improve rendering speed, which is rather slow
currently.

Wolf

a=30;  b=20;  c=10;    //half-axes of ellipse
Step=10;
StartVal_u=0;  EndVal_u=360;    // 10 seconds, 1224 facets, 614 vertices,
2
volumes
StartVal_v=0;  EndVal_v=180;
//StartVal_u=10;  EndVal_u=360;    // 10 seconds, 1190 facets, 614
vertices, 1 volumes
//StartVal_v=0;  EndVal_v=180;

//scale([a,b,c])    sphere(1,$fn=51);      // used in debugging

for (v=[StartVal_v+Step/2:Step:EndVal_v])  for
(u=[StartVal_u+Step/2:Step:EndVal_u])  SurfaceElement(u,v);

module SurfaceElement(u,v)
{ Center=P(u,v);                    // centre vector for SurfaceElement()
P0=P(u-Step/2,v-Step/2);          // corner vector for SurfaceElement()
P1=P(u+Step/2,v-Step/2);          // corner vector for SurfaceElement()
P2=P(u+Step/2,v+Step/2);          // corner vector for SurfaceElement()
P3=P(u-Step/2,v+Step/2);          // corner vector for SurfaceElement()
//  translate(Center)    color("magenta")  cube([.3,.3,.3],
center=true);
// used in debugging
//    translate(P0)        color("red")      cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P1)        color("white")    cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P2)        color("green")    cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P3)        color("yellow")    cube([.3,.3,.03],
center=true);  // used in debugging
//    polygon(P0,P1,P2);  // accepts only 2-vectors
//    polygon(P0,P2,P3);  // accepts only 2-vectors
if(P0 != P1 && P1 != P2)  color("red")    polyhedron
(points=[P0,P1,P2], faces=[[0,1,2]]);
if(P0 != P2 && P2 != P3)  color("yellow")  polyhedron
(points=[P0,P2,P3], faces=[[0,1,2]]);
// CGAL does'nt like degenerate faces!
//  polyhedron (points=[P0,P1,P2,P3], faces=[[0,1,2,3]]);  // non-planar
face, CGAl complains
//  echo(u-Step/2,u+Step/2,v-Step/2,v+Step/2,P0,P1,P2,P3,Center);
}

function P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)];  //point on
the surface of an ellipsoid

--
View this message in context:
http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14292.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Hi Wolf: nice work. If I remember correctly this was not allowed in older versions. Why dont you remove the debugging and and post your code into a new thread? 2015-11-06 20:56 GMT+01:00 wolf <wv99999@gmail.com>: > This code creates an ellipsoid out of individual triangles - not those 2D > primitives you find described in the manual, as these are not compatible > with CGAL in a 3D environment. Rather, my 2D primitives use an undocumented > property of polyhedron(). > > I'll leave the comments in, this is experimental and unfinished code . . . > <http://forum.openscad.org/file/n14292/Ellipsoid.ellipsoid> When > finished, > I intend to submit the code to the team to be implemented as a variant of > surface(). That should improve rendering speed, which is rather slow > currently. > > Wolf > > a=30; b=20; c=10; //half-axes of ellipse > Step=10; > StartVal_u=0; EndVal_u=360; // 10 seconds, 1224 facets, 614 vertices, > 2 > volumes > StartVal_v=0; EndVal_v=180; > //StartVal_u=10; EndVal_u=360; // 10 seconds, 1190 facets, 614 > vertices, 1 volumes > //StartVal_v=0; EndVal_v=180; > > > //scale([a,b,c]) sphere(1,$fn=51); // used in debugging > > for (v=[StartVal_v+Step/2:Step:EndVal_v]) for > (u=[StartVal_u+Step/2:Step:EndVal_u]) SurfaceElement(u,v); > > > module SurfaceElement(u,v) > { Center=P(u,v); // centre vector for SurfaceElement() > P0=P(u-Step/2,v-Step/2); // corner vector for SurfaceElement() > P1=P(u+Step/2,v-Step/2); // corner vector for SurfaceElement() > P2=P(u+Step/2,v+Step/2); // corner vector for SurfaceElement() > P3=P(u-Step/2,v+Step/2); // corner vector for SurfaceElement() > // translate(Center) color("magenta") cube([.3,.3,.3], > center=true); > // used in debugging > // translate(P0) color("red") cube([.3,.3,.03], > center=true); // used in debugging > // translate(P1) color("white") cube([.3,.3,.03], > center=true); // used in debugging > // translate(P2) color("green") cube([.3,.3,.03], > center=true); // used in debugging > // translate(P3) color("yellow") cube([.3,.3,.03], > center=true); // used in debugging > // polygon(P0,P1,P2); // accepts only 2-vectors > // polygon(P0,P2,P3); // accepts only 2-vectors > if(P0 != P1 && P1 != P2) color("red") polyhedron > (points=[P0,P1,P2], faces=[[0,1,2]]); > if(P0 != P2 && P2 != P3) color("yellow") polyhedron > (points=[P0,P2,P3], faces=[[0,1,2]]); > // CGAL does'nt like degenerate faces! > // polyhedron (points=[P0,P1,P2,P3], faces=[[0,1,2,3]]); // non-planar > face, CGAl complains > // echo(u-Step/2,u+Step/2,v-Step/2,v+Step/2,P0,P1,P2,P3,Center); > } > > function P(u,v)=[a*cos(u)*sin(v),b*sin(u)*sin(v),c*cos(v)]; //point on > the surface of an ellipsoid > > > > -- > View this message in context: > http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14292.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
DM
doug moen
Sun, Nov 8, 2015 4:00 PM

I tried Wolf's ellipsoid in OpenSCAD 2014.03, and got a lot of CGAL
assertion errors.

Those error messages went away in OpenSCAD 2015.03. However, when I tried
to intersect the ellipsoid with a cylinder, I got garbage results, and a
message indicating that my object is non-manifold.

Wolf's program is not a valid OpenSCAD program, and does not construct a
valid 3D shape. I consider it a bug that there are no error messages in
OpenSCAD 2015.03 until you try to apply a geometric operation to the
ellipsoid.

On 6 November 2015 at 14:56, wolf wv99999@gmail.com wrote:

This code creates an ellipsoid out of individual triangles - not those 2D
primitives you find described in the manual, as these are not compatible
with CGAL in a 3D environment. Rather, my 2D primitives use an undocumented
property of polyhedron().

I'll leave the comments in, this is experimental and unfinished code . . .
http://forum.openscad.org/file/n14292/Ellipsoid.ellipsoid  When
finished,
I intend to submit the code to the team to be implemented as a variant of
surface(). That should improve rendering speed, which is rather slow
currently.

Wolf

a=30;  b=20;  c=10;    //half-axes of ellipse
Step=10;
StartVal_u=0;  EndVal_u=360;    // 10 seconds, 1224 facets, 614 vertices,
2
volumes
StartVal_v=0;  EndVal_v=180;
//StartVal_u=10;  EndVal_u=360;    // 10 seconds, 1190 facets, 614
vertices, 1 volumes
//StartVal_v=0;  EndVal_v=180;

//scale([a,b,c])    sphere(1,$fn=51);      // used in debugging

for (v=[StartVal_v+Step/2:Step:EndVal_v])  for
(u=[StartVal_u+Step/2:Step:EndVal_u])  SurfaceElement(u,v);

module SurfaceElement(u,v)
{ Center=P(u,v);                    // centre vector for SurfaceElement()
P0=P(u-Step/2,v-Step/2);          // corner vector for SurfaceElement()
P1=P(u+Step/2,v-Step/2);          // corner vector for SurfaceElement()
P2=P(u+Step/2,v+Step/2);          // corner vector for SurfaceElement()
P3=P(u-Step/2,v+Step/2);          // corner vector for SurfaceElement()
//  translate(Center)    color("magenta")  cube([.3,.3,.3],
center=true);
// used in debugging
//    translate(P0)        color("red")      cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P1)        color("white")    cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P2)        color("green")    cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P3)        color("yellow")    cube([.3,.3,.03],
center=true);  // used in debugging
//    polygon(P0,P1,P2);  // accepts only 2-vectors
//    polygon(P0,P2,P3);  // accepts only 2-vectors
if(P0 != P1 && P1 != P2)  color("red")    polyhedron
(points=[P0,P1,P2], faces=[[0,1,2]]);
if(P0 != P2 && P2 != P3)  color("yellow")  polyhedron
(points=[P0,P2,P3], faces=[[0,1,2]]);
// CGAL does'nt like degenerate faces!
//  polyhedron (points=[P0,P1,P2,P3], faces=[[0,1,2,3]]);  // non-planar
face, CGAl complains
//  echo(u-Step/2,u+Step/2,v-Step/2,v+Step/2,P0,P1,P2,P3,Center);
}

function P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)];  //point on
the surface of an ellipsoid

--
View this message in context:
http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14292.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I tried Wolf's ellipsoid in OpenSCAD 2014.03, and got a lot of CGAL assertion errors. Those error messages went away in OpenSCAD 2015.03. However, when I tried to intersect the ellipsoid with a cylinder, I got garbage results, and a message indicating that my object is non-manifold. Wolf's program is not a valid OpenSCAD program, and does not construct a valid 3D shape. I consider it a bug that there are no error messages in OpenSCAD 2015.03 until you try to apply a geometric operation to the ellipsoid. On 6 November 2015 at 14:56, wolf <wv99999@gmail.com> wrote: > This code creates an ellipsoid out of individual triangles - not those 2D > primitives you find described in the manual, as these are not compatible > with CGAL in a 3D environment. Rather, my 2D primitives use an undocumented > property of polyhedron(). > > I'll leave the comments in, this is experimental and unfinished code . . . > <http://forum.openscad.org/file/n14292/Ellipsoid.ellipsoid> When > finished, > I intend to submit the code to the team to be implemented as a variant of > surface(). That should improve rendering speed, which is rather slow > currently. > > Wolf > > a=30; b=20; c=10; //half-axes of ellipse > Step=10; > StartVal_u=0; EndVal_u=360; // 10 seconds, 1224 facets, 614 vertices, > 2 > volumes > StartVal_v=0; EndVal_v=180; > //StartVal_u=10; EndVal_u=360; // 10 seconds, 1190 facets, 614 > vertices, 1 volumes > //StartVal_v=0; EndVal_v=180; > > > //scale([a,b,c]) sphere(1,$fn=51); // used in debugging > > for (v=[StartVal_v+Step/2:Step:EndVal_v]) for > (u=[StartVal_u+Step/2:Step:EndVal_u]) SurfaceElement(u,v); > > > module SurfaceElement(u,v) > { Center=P(u,v); // centre vector for SurfaceElement() > P0=P(u-Step/2,v-Step/2); // corner vector for SurfaceElement() > P1=P(u+Step/2,v-Step/2); // corner vector for SurfaceElement() > P2=P(u+Step/2,v+Step/2); // corner vector for SurfaceElement() > P3=P(u-Step/2,v+Step/2); // corner vector for SurfaceElement() > // translate(Center) color("magenta") cube([.3,.3,.3], > center=true); > // used in debugging > // translate(P0) color("red") cube([.3,.3,.03], > center=true); // used in debugging > // translate(P1) color("white") cube([.3,.3,.03], > center=true); // used in debugging > // translate(P2) color("green") cube([.3,.3,.03], > center=true); // used in debugging > // translate(P3) color("yellow") cube([.3,.3,.03], > center=true); // used in debugging > // polygon(P0,P1,P2); // accepts only 2-vectors > // polygon(P0,P2,P3); // accepts only 2-vectors > if(P0 != P1 && P1 != P2) color("red") polyhedron > (points=[P0,P1,P2], faces=[[0,1,2]]); > if(P0 != P2 && P2 != P3) color("yellow") polyhedron > (points=[P0,P2,P3], faces=[[0,1,2]]); > // CGAL does'nt like degenerate faces! > // polyhedron (points=[P0,P1,P2,P3], faces=[[0,1,2,3]]); // non-planar > face, CGAl complains > // echo(u-Step/2,u+Step/2,v-Step/2,v+Step/2,P0,P1,P2,P3,Center); > } > > function P(u,v)=[a*cos(u)*sin(v),b*sin(u)*sin(v),c*cos(v)]; //point on > the surface of an ellipsoid > > > > -- > View this message in context: > http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14292.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > >
PF
Peter Falke
Sun, Nov 8, 2015 7:03 PM

From a constracten point of view, it would be nice if OpneSCAD would allow

the piecewise construction of polyhedron.
When you do e.g. a extrusion along a path, it would be easier to have 3 for
loop: for the top, the side, and the button.

Mybe with a syntax like:

polyhedron(...);
continue_polyhedron(...);

2015-11-08 17:00 GMT+01:00 doug moen doug@moens.org:

I tried Wolf's ellipsoid in OpenSCAD 2014.03, and got a lot of CGAL
assertion errors.

Those error messages went away in OpenSCAD 2015.03. However, when I tried
to intersect the ellipsoid with a cylinder, I got garbage results, and a
message indicating that my object is non-manifold.

Wolf's program is not a valid OpenSCAD program, and does not construct a
valid 3D shape. I consider it a bug that there are no error messages in
OpenSCAD 2015.03 until you try to apply a geometric operation to the
ellipsoid.

On 6 November 2015 at 14:56, wolf wv99999@gmail.com wrote:

This code creates an ellipsoid out of individual triangles - not those 2D
primitives you find described in the manual, as these are not compatible
with CGAL in a 3D environment. Rather, my 2D primitives use an
undocumented
property of polyhedron().

I'll leave the comments in, this is experimental and unfinished code . . .
http://forum.openscad.org/file/n14292/Ellipsoid.ellipsoid  When
finished,
I intend to submit the code to the team to be implemented as a variant of
surface(). That should improve rendering speed, which is rather slow
currently.

Wolf

a=30;  b=20;  c=10;    //half-axes of ellipse
Step=10;
StartVal_u=0;  EndVal_u=360;    // 10 seconds, 1224 facets, 614
vertices, 2
volumes
StartVal_v=0;  EndVal_v=180;
//StartVal_u=10;  EndVal_u=360;    // 10 seconds, 1190 facets, 614
vertices, 1 volumes
//StartVal_v=0;  EndVal_v=180;

//scale([a,b,c])    sphere(1,$fn=51);      // used in debugging

for (v=[StartVal_v+Step/2:Step:EndVal_v])  for
(u=[StartVal_u+Step/2:Step:EndVal_u])  SurfaceElement(u,v);

module SurfaceElement(u,v)
{ Center=P(u,v);                    // centre vector for
SurfaceElement()
P0=P(u-Step/2,v-Step/2);          // corner vector for
SurfaceElement()
P1=P(u+Step/2,v-Step/2);          // corner vector for
SurfaceElement()
P2=P(u+Step/2,v+Step/2);          // corner vector for
SurfaceElement()
P3=P(u-Step/2,v+Step/2);          // corner vector for
SurfaceElement()
//  translate(Center)    color("magenta")  cube([.3,.3,.3],
center=true);
// used in debugging
//    translate(P0)        color("red")      cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P1)        color("white")    cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P2)        color("green")    cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P3)        color("yellow")    cube([.3,.3,.03],
center=true);  // used in debugging
//    polygon(P0,P1,P2);  // accepts only 2-vectors
//    polygon(P0,P2,P3);  // accepts only 2-vectors
if(P0 != P1 && P1 != P2)  color("red")    polyhedron
(points=[P0,P1,P2], faces=[[0,1,2]]);
if(P0 != P2 && P2 != P3)  color("yellow")  polyhedron
(points=[P0,P2,P3], faces=[[0,1,2]]);
// CGAL does'nt like degenerate faces!
//  polyhedron (points=[P0,P1,P2,P3], faces=[[0,1,2,3]]);  // non-planar
face, CGAl complains
//  echo(u-Step/2,u+Step/2,v-Step/2,v+Step/2,P0,P1,P2,P3,Center);
}

function P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)];  //point on
the surface of an ellipsoid

--
View this message in context:
http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14292.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

>From a constracten point of view, it would be nice if OpneSCAD would allow the piecewise construction of polyhedron. When you do e.g. a extrusion along a path, it would be easier to have 3 for loop: for the top, the side, and the button. Mybe with a syntax like: polyhedron(...); continue_polyhedron(...); 2015-11-08 17:00 GMT+01:00 doug moen <doug@moens.org>: > I tried Wolf's ellipsoid in OpenSCAD 2014.03, and got a lot of CGAL > assertion errors. > > Those error messages went away in OpenSCAD 2015.03. However, when I tried > to intersect the ellipsoid with a cylinder, I got garbage results, and a > message indicating that my object is non-manifold. > > Wolf's program is not a valid OpenSCAD program, and does not construct a > valid 3D shape. I consider it a bug that there are no error messages in > OpenSCAD 2015.03 until you try to apply a geometric operation to the > ellipsoid. > > On 6 November 2015 at 14:56, wolf <wv99999@gmail.com> wrote: > >> This code creates an ellipsoid out of individual triangles - not those 2D >> primitives you find described in the manual, as these are not compatible >> with CGAL in a 3D environment. Rather, my 2D primitives use an >> undocumented >> property of polyhedron(). >> >> I'll leave the comments in, this is experimental and unfinished code . . . >> <http://forum.openscad.org/file/n14292/Ellipsoid.ellipsoid> When >> finished, >> I intend to submit the code to the team to be implemented as a variant of >> surface(). That should improve rendering speed, which is rather slow >> currently. >> >> Wolf >> >> a=30; b=20; c=10; //half-axes of ellipse >> Step=10; >> StartVal_u=0; EndVal_u=360; // 10 seconds, 1224 facets, 614 >> vertices, 2 >> volumes >> StartVal_v=0; EndVal_v=180; >> //StartVal_u=10; EndVal_u=360; // 10 seconds, 1190 facets, 614 >> vertices, 1 volumes >> //StartVal_v=0; EndVal_v=180; >> >> >> //scale([a,b,c]) sphere(1,$fn=51); // used in debugging >> >> for (v=[StartVal_v+Step/2:Step:EndVal_v]) for >> (u=[StartVal_u+Step/2:Step:EndVal_u]) SurfaceElement(u,v); >> >> >> module SurfaceElement(u,v) >> { Center=P(u,v); // centre vector for >> SurfaceElement() >> P0=P(u-Step/2,v-Step/2); // corner vector for >> SurfaceElement() >> P1=P(u+Step/2,v-Step/2); // corner vector for >> SurfaceElement() >> P2=P(u+Step/2,v+Step/2); // corner vector for >> SurfaceElement() >> P3=P(u-Step/2,v+Step/2); // corner vector for >> SurfaceElement() >> // translate(Center) color("magenta") cube([.3,.3,.3], >> center=true); >> // used in debugging >> // translate(P0) color("red") cube([.3,.3,.03], >> center=true); // used in debugging >> // translate(P1) color("white") cube([.3,.3,.03], >> center=true); // used in debugging >> // translate(P2) color("green") cube([.3,.3,.03], >> center=true); // used in debugging >> // translate(P3) color("yellow") cube([.3,.3,.03], >> center=true); // used in debugging >> // polygon(P0,P1,P2); // accepts only 2-vectors >> // polygon(P0,P2,P3); // accepts only 2-vectors >> if(P0 != P1 && P1 != P2) color("red") polyhedron >> (points=[P0,P1,P2], faces=[[0,1,2]]); >> if(P0 != P2 && P2 != P3) color("yellow") polyhedron >> (points=[P0,P2,P3], faces=[[0,1,2]]); >> // CGAL does'nt like degenerate faces! >> // polyhedron (points=[P0,P1,P2,P3], faces=[[0,1,2,3]]); // non-planar >> face, CGAl complains >> // echo(u-Step/2,u+Step/2,v-Step/2,v+Step/2,P0,P1,P2,P3,Center); >> } >> >> function P(u,v)=[a*cos(u)*sin(v),b*sin(u)*sin(v),c*cos(v)]; //point on >> the surface of an ellipsoid >> >> >> >> -- >> View this message in context: >> http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14292.html >> Sent from the OpenSCAD mailing list archive at Nabble.com. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
NH
nop head
Sun, Nov 8, 2015 7:20 PM

Polyhedron takes lists and lists can be created with for loops in recent
versions of OpenScad, so you can do exactly that without new syntax.

On 8 November 2015 at 19:03, Peter Falke <
stempeldergeschichte@googlemail.com> wrote:

From a constracten point of view, it would be nice if OpneSCAD would allow
the piecewise construction of polyhedron.
When you do e.g. a extrusion along a path, it would be easier to have 3
for loop: for the top, the side, and the button.

Mybe with a syntax like:

polyhedron(...);
continue_polyhedron(...);

2015-11-08 17:00 GMT+01:00 doug moen doug@moens.org:

I tried Wolf's ellipsoid in OpenSCAD 2014.03, and got a lot of CGAL
assertion errors.

Those error messages went away in OpenSCAD 2015.03. However, when I tried
to intersect the ellipsoid with a cylinder, I got garbage results, and a
message indicating that my object is non-manifold.

Wolf's program is not a valid OpenSCAD program, and does not construct a
valid 3D shape. I consider it a bug that there are no error messages in
OpenSCAD 2015.03 until you try to apply a geometric operation to the
ellipsoid.

On 6 November 2015 at 14:56, wolf wv99999@gmail.com wrote:

This code creates an ellipsoid out of individual triangles - not those 2D
primitives you find described in the manual, as these are not compatible
with CGAL in a 3D environment. Rather, my 2D primitives use an
undocumented
property of polyhedron().

I'll leave the comments in, this is experimental and unfinished code . .
.
http://forum.openscad.org/file/n14292/Ellipsoid.ellipsoid  When
finished,
I intend to submit the code to the team to be implemented as a variant of
surface(). That should improve rendering speed, which is rather slow
currently.

Wolf

a=30;  b=20;  c=10;    //half-axes of ellipse
Step=10;
StartVal_u=0;  EndVal_u=360;    // 10 seconds, 1224 facets, 614
vertices, 2
volumes
StartVal_v=0;  EndVal_v=180;
//StartVal_u=10;  EndVal_u=360;    // 10 seconds, 1190 facets, 614
vertices, 1 volumes
//StartVal_v=0;  EndVal_v=180;

//scale([a,b,c])    sphere(1,$fn=51);      // used in debugging

for (v=[StartVal_v+Step/2:Step:EndVal_v])  for
(u=[StartVal_u+Step/2:Step:EndVal_u])  SurfaceElement(u,v);

module SurfaceElement(u,v)
{ Center=P(u,v);                    // centre vector for
SurfaceElement()
P0=P(u-Step/2,v-Step/2);          // corner vector for
SurfaceElement()
P1=P(u+Step/2,v-Step/2);          // corner vector for
SurfaceElement()
P2=P(u+Step/2,v+Step/2);          // corner vector for
SurfaceElement()
P3=P(u-Step/2,v+Step/2);          // corner vector for
SurfaceElement()
//  translate(Center)    color("magenta")  cube([.3,.3,.3],
center=true);
// used in debugging
//    translate(P0)        color("red")      cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P1)        color("white")    cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P2)        color("green")    cube([.3,.3,.03],
center=true);  // used in debugging
//    translate(P3)        color("yellow")    cube([.3,.3,.03],
center=true);  // used in debugging
//    polygon(P0,P1,P2);  // accepts only 2-vectors
//    polygon(P0,P2,P3);  // accepts only 2-vectors
if(P0 != P1 && P1 != P2)  color("red")    polyhedron
(points=[P0,P1,P2], faces=[[0,1,2]]);
if(P0 != P2 && P2 != P3)  color("yellow")  polyhedron
(points=[P0,P2,P3], faces=[[0,1,2]]);
// CGAL does'nt like degenerate faces!
//  polyhedron (points=[P0,P1,P2,P3], faces=[[0,1,2,3]]);  //
non-planar
face, CGAl complains
//  echo(u-Step/2,u+Step/2,v-Step/2,v+Step/2,P0,P1,P2,P3,Center);
}

function P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)];  //point on
the surface of an ellipsoid

--
View this message in context:
http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14292.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Polyhedron takes lists and lists can be created with for loops in recent versions of OpenScad, so you can do exactly that without new syntax. On 8 November 2015 at 19:03, Peter Falke < stempeldergeschichte@googlemail.com> wrote: > From a constracten point of view, it would be nice if OpneSCAD would allow > the piecewise construction of polyhedron. > When you do e.g. a extrusion along a path, it would be easier to have 3 > for loop: for the top, the side, and the button. > > Mybe with a syntax like: > > polyhedron(...); > continue_polyhedron(...); > > 2015-11-08 17:00 GMT+01:00 doug moen <doug@moens.org>: > >> I tried Wolf's ellipsoid in OpenSCAD 2014.03, and got a lot of CGAL >> assertion errors. >> >> Those error messages went away in OpenSCAD 2015.03. However, when I tried >> to intersect the ellipsoid with a cylinder, I got garbage results, and a >> message indicating that my object is non-manifold. >> >> Wolf's program is not a valid OpenSCAD program, and does not construct a >> valid 3D shape. I consider it a bug that there are no error messages in >> OpenSCAD 2015.03 until you try to apply a geometric operation to the >> ellipsoid. >> >> On 6 November 2015 at 14:56, wolf <wv99999@gmail.com> wrote: >> >>> This code creates an ellipsoid out of individual triangles - not those 2D >>> primitives you find described in the manual, as these are not compatible >>> with CGAL in a 3D environment. Rather, my 2D primitives use an >>> undocumented >>> property of polyhedron(). >>> >>> I'll leave the comments in, this is experimental and unfinished code . . >>> . >>> <http://forum.openscad.org/file/n14292/Ellipsoid.ellipsoid> When >>> finished, >>> I intend to submit the code to the team to be implemented as a variant of >>> surface(). That should improve rendering speed, which is rather slow >>> currently. >>> >>> Wolf >>> >>> a=30; b=20; c=10; //half-axes of ellipse >>> Step=10; >>> StartVal_u=0; EndVal_u=360; // 10 seconds, 1224 facets, 614 >>> vertices, 2 >>> volumes >>> StartVal_v=0; EndVal_v=180; >>> //StartVal_u=10; EndVal_u=360; // 10 seconds, 1190 facets, 614 >>> vertices, 1 volumes >>> //StartVal_v=0; EndVal_v=180; >>> >>> >>> //scale([a,b,c]) sphere(1,$fn=51); // used in debugging >>> >>> for (v=[StartVal_v+Step/2:Step:EndVal_v]) for >>> (u=[StartVal_u+Step/2:Step:EndVal_u]) SurfaceElement(u,v); >>> >>> >>> module SurfaceElement(u,v) >>> { Center=P(u,v); // centre vector for >>> SurfaceElement() >>> P0=P(u-Step/2,v-Step/2); // corner vector for >>> SurfaceElement() >>> P1=P(u+Step/2,v-Step/2); // corner vector for >>> SurfaceElement() >>> P2=P(u+Step/2,v+Step/2); // corner vector for >>> SurfaceElement() >>> P3=P(u-Step/2,v+Step/2); // corner vector for >>> SurfaceElement() >>> // translate(Center) color("magenta") cube([.3,.3,.3], >>> center=true); >>> // used in debugging >>> // translate(P0) color("red") cube([.3,.3,.03], >>> center=true); // used in debugging >>> // translate(P1) color("white") cube([.3,.3,.03], >>> center=true); // used in debugging >>> // translate(P2) color("green") cube([.3,.3,.03], >>> center=true); // used in debugging >>> // translate(P3) color("yellow") cube([.3,.3,.03], >>> center=true); // used in debugging >>> // polygon(P0,P1,P2); // accepts only 2-vectors >>> // polygon(P0,P2,P3); // accepts only 2-vectors >>> if(P0 != P1 && P1 != P2) color("red") polyhedron >>> (points=[P0,P1,P2], faces=[[0,1,2]]); >>> if(P0 != P2 && P2 != P3) color("yellow") polyhedron >>> (points=[P0,P2,P3], faces=[[0,1,2]]); >>> // CGAL does'nt like degenerate faces! >>> // polyhedron (points=[P0,P1,P2,P3], faces=[[0,1,2,3]]); // >>> non-planar >>> face, CGAl complains >>> // echo(u-Step/2,u+Step/2,v-Step/2,v+Step/2,P0,P1,P2,P3,Center); >>> } >>> >>> function P(u,v)=[a*cos(u)*sin(v),b*sin(u)*sin(v),c*cos(v)]; //point on >>> the surface of an ellipsoid >>> >>> >>> >>> -- >>> View this message in context: >>> http://forum.openscad.org/3d-hull-with-2d-primitives-needed-tp5845p14292.html >>> Sent from the OpenSCAD mailing list archive at Nabble.com. >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> Discuss@lists.openscad.org >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>> >>> >>> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >