A few days ago I posted
http://forum.openscad.org/3d-hull-with-2d-primitives-needed-td5845.htmlhttp://
a piece of code creating an ellipsoid out of individual polyhedron() faces.
As doug.moen
http://forum.openscad.org/Polyhedron-and-cube-Not-a-Valid-2-Manifold-td14283.html
pointed out, it looked like a solid, but was just a collection of faces.
Here I show what happened, and why, and how to make it a solid.
First, recall that
polyhedron
(points=[[0,0,0],[0,1,0],[0,1,1],[0,0,1],[1,0,0],[1,1,0],[1,1,1],[1,0,1]],
faces=[[0,1,2,3],[4,5,6,7],[3,2,6,7],[1,5,6,2],[0,4,7,3],[0,1,5,4]]);
creates a cube, which is a solid.
Multiple calls
polyhedron (points=[[0,0,0],[0,1,0],[0,1,1],[0,0,1]],faces=[[0,1,2,3]]);
polyhedron (points=[[1,0,0],[1,1,0],[1,1,1],[1,0,1]],faces=[[0,1,2,3]]);
polyhedron (points=[[0,0,1],[0,1,1],[1,1,1],[1,0,1]],faces=[[0,1,2,3]]);
polyhedron (points=[[0,1,0],[1,1,0],[1,1,1],[0,1,1]],faces=[[0,1,2,3]]);
polyhedron (points=[[0,0,0],[1,0,0],[1,0,1],[0,0,1]],faces=[[0,1,2,3]]);
polyhedron (points=[[0,0,0],[0,1,0],[1,1,0],[1,0,0]],faces=[[0,1,2,3]]);
create the same cube, but this one is just a collection of faces, and an
intersection() cannot be made.
These faces need to be welded together using hull() to make it a solid that
can be intersected, as follows:
difference()
{ MyCube();
translate([.5,.5,.5]) cylinder(h=2,d=.2,$fn=20,center=true);
}
module MyCube()
hull()
{ color("red") polyhedron
(points=[[0,0,0],[0,1,0],[0,1,1],[0,0,1]],faces=[[0,1,2,3]]);
color("yellow") polyhedron
(points=[[1,0,0],[1,1,0],[1,1,1],[1,0,1]],faces=[[0,1,2,3]]);
color("green") polyhedron
(points=[[0,0,1],[0,1,1],[1,1,1],[1,0,1]],faces=[[0,1,2,3]]);
color("magenta") polyhedron
(points=[[0,1,0],[1,1,0],[1,1,1],[0,1,1]],faces=[[0,1,2,3]]);
color("pink") polyhedron
(points=[[0,0,0],[1,0,0],[1,0,1],[0,0,1]],faces=[[0,1,2,3]]);
color("purple") polyhedron
(points=[[0,0,0],[0,1,0],[1,1,0],[1,0,0]],faces=[[0,1,2,3]]);
}
With hull() commented out, each face of the cube has a different colour, and
behaves as a separate entity. With hull() active, all faces have the same
colour, and there is only one entity, a cube. hull() does even more: it
allows you to remove the last three calls to polyhedron() without affecting
the cube. Since calls to polyhedron() are rather slow, using hull() actually
speeds up rendering.
The code for the ellipsoid has been given this optimization, and rendering
times have dropped from 10 seconds on my machine to 5 seconds - always with
cache flushed.
This is the optimised code:
a=30; b=20; c=10; //half-axes of ellipse
Step=10;
difference() { h(); cylinder(h=40, d=2, center=true, $fn=20);}
module h()
hull() Ellipsoid();
module Ellipsoid()
for (v=[Step/2:Step:180-Step]) for (u=[Step/2:Step:360-Step/2])
SurfaceElement(u,v);
module SurfaceElement(u,v)
{ 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()
polyhedron (points=[P0,P1,P2], faces=[[0,1,2]]);
}
function P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)]; //point on the
surface of an ellipsoid
There is no need to merge all points into a single list first, as has been
suggested
http://forum.openscad.org/3d-hull-with-2d-primitives-needed-td5845.html .
But I still would like to know how this is done . . .
Wolf
--
View this message in context: http://forum.openscad.org/Polyhedron-tp14338.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I like this! It seems that it could be used to generate other shapes,
since the "shape" code is all in the final function.
Jon
On 11/10/2015 5:55 AM, wolf wrote:
A few days ago I posted
http://forum.openscad.org/3d-hull-with-2d-primitives-needed-td5845.htmlhttp://
a piece of code creating an ellipsoid out of individual polyhedron() faces.
As doug.moen
http://forum.openscad.org/Polyhedron-and-cube-Not-a-Valid-2-Manifold-td14283.html
pointed out, it looked like a solid, but was just a collection of faces.
Here I show what happened, and why, and how to make it a solid.
First, recall that
polyhedron
(points=[[0,0,0],[0,1,0],[0,1,1],[0,0,1],[1,0,0],[1,1,0],[1,1,1],[1,0,1]],
faces=[[0,1,2,3],[4,5,6,7],[3,2,6,7],[1,5,6,2],[0,4,7,3],[0,1,5,4]]);
creates a cube, which is a solid.
Multiple calls
polyhedron (points=[[0,0,0],[0,1,0],[0,1,1],[0,0,1]],faces=[[0,1,2,3]]);
polyhedron (points=[[1,0,0],[1,1,0],[1,1,1],[1,0,1]],faces=[[0,1,2,3]]);
polyhedron (points=[[0,0,1],[0,1,1],[1,1,1],[1,0,1]],faces=[[0,1,2,3]]);
polyhedron (points=[[0,1,0],[1,1,0],[1,1,1],[0,1,1]],faces=[[0,1,2,3]]);
polyhedron (points=[[0,0,0],[1,0,0],[1,0,1],[0,0,1]],faces=[[0,1,2,3]]);
polyhedron (points=[[0,0,0],[0,1,0],[1,1,0],[1,0,0]],faces=[[0,1,2,3]]);
create the same cube, but this one is just a collection of faces, and an
intersection() cannot be made.
These faces need to be welded together using hull() to make it a solid that
can be intersected, as follows:
difference()
{ MyCube();
translate([.5,.5,.5]) cylinder(h=2,d=.2,$fn=20,center=true);
}
module MyCube()
hull()
{ color("red") polyhedron
(points=[[0,0,0],[0,1,0],[0,1,1],[0,0,1]],faces=[[0,1,2,3]]);
color("yellow") polyhedron
(points=[[1,0,0],[1,1,0],[1,1,1],[1,0,1]],faces=[[0,1,2,3]]);
color("green") polyhedron
(points=[[0,0,1],[0,1,1],[1,1,1],[1,0,1]],faces=[[0,1,2,3]]);
color("magenta") polyhedron
(points=[[0,1,0],[1,1,0],[1,1,1],[0,1,1]],faces=[[0,1,2,3]]);
color("pink") polyhedron
(points=[[0,0,0],[1,0,0],[1,0,1],[0,0,1]],faces=[[0,1,2,3]]);
color("purple") polyhedron
(points=[[0,0,0],[0,1,0],[1,1,0],[1,0,0]],faces=[[0,1,2,3]]);
}
With hull() commented out, each face of the cube has a different colour, and
behaves as a separate entity. With hull() active, all faces have the same
colour, and there is only one entity, a cube. hull() does even more: it
allows you to remove the last three calls to polyhedron() without affecting
the cube. Since calls to polyhedron() are rather slow, using hull() actually
speeds up rendering.
The code for the ellipsoid has been given this optimization, and rendering
times have dropped from 10 seconds on my machine to 5 seconds - always with
cache flushed.
This is the optimised code:
a=30; b=20; c=10; //half-axes of ellipse
Step=10;
difference() { h(); cylinder(h=40, d=2, center=true, $fn=20);}
module h()
hull() Ellipsoid();
module Ellipsoid()
for (v=[Step/2:Step:180-Step]) for (u=[Step/2:Step:360-Step/2])
SurfaceElement(u,v);
module SurfaceElement(u,v)
{ 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()
polyhedron (points=[P0,P1,P2], faces=[[0,1,2]]);
}
function P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)]; //point on the
surface of an ellipsoid
There is no need to merge all points into a single list first, as has been
suggested
http://forum.openscad.org/3d-hull-with-2d-primitives-needed-td5845.html .
But I still would like to know how this is done . . .
Wolf
--
View this message in context: http://forum.openscad.org/Polyhedron-tp14338.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
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7227 / Virus Database: 4457/10972 - Release Date: 11/09/15
This is how you do it with list comprehensions to make a manifold polyhedron
that doesn't need wrapping in hull.a=30; b=20; c=10; //half-axes of
ellipseStep=10; function P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)];
//point on the surface of an ellipsoid function SurfaceElement(u,v) =
let(hs = Step / 2) [ P(u - hs, v - hs),
P(u + hs, v - hs), P(u +
hs, v + hs), P(u - hs, v
--
View this message in context: http://forum.openscad.org/Polyhedron-tp14338p14340.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hmm, all the newlines got eaten but I have fixed it on the forum post.
On 10 November 2015 at 12:05, nophead nop.head@gmail.com wrote:
This is how you do it with list comprehensions to make a manifold
polyhedron that doesn't need wrapping in hull. a=30; b=20; c=10;
//half-axes of ellipse Step=10; function
P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)]; //point on the surface
of an ellipsoid function SurfaceElement(u,v) = let(hs = Step / 2) [ P(u -
hs, v - hs), P(u + hs, v - hs), P(u + hs, v + hs), P(u - hs, v + hs)];
function quad(i) = let(p = i * 4) [[p, p + 1, p + 2], [p, p + 2, p + 3]];
function flatten(l) = [ for (a = l) for (b = a) b ] ; elements =
flatten([let(s = Step / 2) for(v = [s : Step : 180 - s]) for(u = [s : Step:
360 - s]) SurfaceElement(u, v)]); faces = flatten([for(v = [0 : 180 / Step
View this message in context: Re: Polyhedron()
http://forum.openscad.org/Polyhedron-tp14338p14340.html
Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
It is nice that hull() accepts a collection of non-manifold faces.
Does anyone know: would hull() also accept a collection of points as inputs?
Even if you can not define a point in OpenSCAD, (yet).
2015-11-10 13:08 GMT+01:00 nop head nop.head@gmail.com:
Hmm, all the newlines got eaten but I have fixed it on the forum post.
On 10 November 2015 at 12:05, nophead nop.head@gmail.com wrote:
This is how you do it with list comprehensions to make a manifold
polyhedron that doesn't need wrapping in hull. a=30; b=20; c=10;
//half-axes of ellipse Step=10; function
P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)]; //point on the surface
of an ellipsoid function SurfaceElement(u,v) = let(hs = Step / 2) [ P(u -
hs, v - hs), P(u + hs, v - hs), P(u + hs, v + hs), P(u - hs, v + hs)];
function quad(i) = let(p = i * 4) [[p, p + 1, p + 2], [p, p + 2, p + 3]];
function flatten(l) = [ for (a = l) for (b = a) b ] ; elements =
flatten([let(s = Step / 2) for(v = [s : Step : 180 - s]) for(u = [s : Step:
360 - s]) SurfaceElement(u, v)]); faces = flatten([for(v = [0 : 180 / Step
View this message in context: Re: Polyhedron()
http://forum.openscad.org/Polyhedron-tp14338p14340.html
Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Dear nop head,
your solution looks nice and clean
I'm sort of able to follow your code, but I would not be able to write it
myself.
After looking at your code for a while I realised that there could be a
gain in velocity by a factor of 2:
p + 2, p + 3 of the old faces is identically to p , p +1 of the new faces.
(while iterating over u)
I sort of know how to do it:
Only write the points p , p+1 for every SurfaceElement(u,v) into elements.
And rewrite quad(i) correspondingly.
Also quad(i) most be modified to deal with the last point to wrap around to
the first points: p0, p0+1.
There should also be a gain in velocity while iterating in v - direction,
half the points are already known from the last iteration.
...
I had a look at the preview time: 9 sec with steps set to Steps=1 (degree).
This is very fast and a very high resolution (corresponds to fn=360).
The render time is (on my computer) 1min 40sec with steps set to Steps=1
(degree).
This is also very fast for this fine resolution.
So, my idea for speeding up the code is probably not needed. :-)
2015-11-10 13:08 GMT+01:00 nop head nop.head@gmail.com:
Hmm, all the newlines got eaten but I have fixed it on the forum post.
On 10 November 2015 at 12:05, nophead nop.head@gmail.com wrote:
This is how you do it with list comprehensions to make a manifold
polyhedron that doesn't need wrapping in hull. a=30; b=20; c=10;
//half-axes of ellipse Step=10; function
P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)]; //point on the surface
of an ellipsoid function SurfaceElement(u,v) = let(hs = Step / 2) [ P(u -
hs, v - hs), P(u + hs, v - hs), P(u + hs, v + hs), P(u - hs, v + hs)];
function quad(i) = let(p = i * 4) [[p, p + 1, p + 2], [p, p + 2, p + 3]];
function flatten(l) = [ for (a = l) for (b = a) b ] ; elements =
flatten([let(s = Step / 2) for(v = [s : Step : 180 - s]) for(u = [s : Step:
360 - s]) SurfaceElement(u, v)]); faces = flatten([for(v = [0 : 180 / Step
View this message in context: Re: Polyhedron()
http://forum.openscad.org/Polyhedron-tp14338p14340.html
Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
There is a grave error in my last post:
Yes, on could save time calculating less points P(u,v), but this would only
speed up the preview somewhat.
But the preview is very fast anyway.
It wouls not noticeably speed up the time to render: the time to create the
polyhedron is what takes so long,
2015-11-10 15:56 GMT+01:00 Peter Falke stempeldergeschichte@googlemail.com
:
Dear nop head,
your solution looks nice and clean
I'm sort of able to follow your code, but I would not be able to write it
myself.
After looking at your code for a while I realised that there could be a
gain in velocity by a factor of 2:
p + 2, p + 3 of the old faces is identically to p , p +1 of the new
faces. (while iterating over u)
I sort of know how to do it:
Only write the points p , p+1 for every SurfaceElement(u,v) into elements.
And rewrite quad(i) correspondingly.
Also quad(i) most be modified to deal with the last point to wrap around
to the first points: p0, p0+1.
There should also be a gain in velocity while iterating in v - direction,
half the points are already known from the last iteration.
...
I had a look at the preview time: 9 sec with steps set to Steps=1 (degree).
This is very fast and a very high resolution (corresponds to fn=360).
The render time is (on my computer) 1min 40sec with steps set to Steps=1
(degree).
This is also very fast for this fine resolution.
So, my idea for speeding up the code is probably not needed. :-)
2015-11-10 13:08 GMT+01:00 nop head nop.head@gmail.com:
Hmm, all the newlines got eaten but I have fixed it on the forum post.
On 10 November 2015 at 12:05, nophead nop.head@gmail.com wrote:
This is how you do it with list comprehensions to make a manifold
polyhedron that doesn't need wrapping in hull. a=30; b=20; c=10;
//half-axes of ellipse Step=10; function
P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)]; //point on the surface
of an ellipsoid function SurfaceElement(u,v) = let(hs = Step / 2) [ P(u -
hs, v - hs), P(u + hs, v - hs), P(u + hs, v + hs), P(u - hs, v + hs)];
function quad(i) = let(p = i * 4) [[p, p + 1, p + 2], [p, p + 2, p + 3]];
function flatten(l) = [ for (a = l) for (b = a) b ] ; elements =
flatten([let(s = Step / 2) for(v = [s : Step : 180 - s]) for(u = [s : Step:
360 - s]) SurfaceElement(u, v)]); faces = flatten([for(v = [0 : 180 / Step
View this message in context: Re: Polyhedron()
http://forum.openscad.org/Polyhedron-tp14338p14340.html
Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
I think that the underlying topic of discussion is: polyhedron() is
difficult to use. Is there an easier way to convert a collection of
vertices into a 3D object?
Wolf has explored the idea of gluing a cloud of non-manifold objects into a
polyhedron using hull(). It relies on passing an invalid argument list to
polyhedron(), and relying on the fact that you don't currently get an
error. Worse, this technique is not general, since it can't be used to
construct a non-convex object. It's also much slower than directly
constructing your object with a single call to polyhedron().
Peter Falke has suggested the idea of feeding a collection of points to
hull(). I don't think there's any way to do that right now. But it's an
interesting suggestion, since specifying a point cloud is easier to do than
specifying a disconnected cloud of faces (as in Wolf's code), which in turn
is easier than specifying a connected set of faces (ie, the arguments to
polyhedron()).
The raw output from a 3D scanner is a point cloud. There exists software
for converting this point cloud into a polyhedral mesh. I think it would be
interesting to add a point_cloud() operation to OpenSCAD, for converting a
list of vertices into a manifold 3D object. The algorithm should exist
somewhere as open source. It's probably slower than polyhedron(), but much
easier to use.
The point_cloud() primitive would give us very simple and easy to write
code for generating an ellipsoid. Something like this:
a=30; b=20; c=10; //half-axes of ellipse
Step=10;
point_cloud(
[for (v=[0: Step: 180])
for (u=[0: Step: 360])
P(u,v)
]);
function P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)];
On 10 November 2015 at 09:32, Peter Falke <
stempeldergeschichte@googlemail.com> wrote:
It is nice that hull() accepts a collection of non-manifold faces.
Does anyone know: would hull() also accept a collection of points as
inputs?
Even if you can not define a point in OpenSCAD, (yet).
2015-11-10 13:08 GMT+01:00 nop head nop.head@gmail.com:
Hmm, all the newlines got eaten but I have fixed it on the forum post.
On 10 November 2015 at 12:05, nophead nop.head@gmail.com wrote:
This is how you do it with list comprehensions to make a manifold
polyhedron that doesn't need wrapping in hull. a=30; b=20; c=10;
//half-axes of ellipse Step=10; function
P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)]; //point on the surface
of an ellipsoid function SurfaceElement(u,v) = let(hs = Step / 2) [ P(u -
hs, v - hs), P(u + hs, v - hs), P(u + hs, v + hs), P(u - hs, v + hs)];
function quad(i) = let(p = i * 4) [[p, p + 1, p + 2], [p, p + 2, p + 3]];
function flatten(l) = [ for (a = l) for (b = a) b ] ; elements =
flatten([let(s = Step / 2) for(v = [s : Step : 180 - s]) for(u = [s : Step:
360 - s]) SurfaceElement(u, v)]); faces = flatten([for(v = [0 : 180 / Step
View this message in context: Re: Polyhedron()
http://forum.openscad.org/Polyhedron-tp14338p14340.html
Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
doug.moen wrote
I think that the underlying topic of discussion is: polyhedron() is
difficult to use. Is there an easier way to convert a collection of
vertices into a 3D object?
...
There are surface reconstruction hooks in CGAL:
http://doc.cgal.org/latest/Surface_reconstruction_points_3/
...but as with many things, the devil's in the implementation-details.
Andrew.
--
View this message in context: http://forum.openscad.org/Polyhedron-tp14338p14347.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Yes and a 2D version would be very useful as well. It would basically fit
a curve through a list of points, although there are many ways to do that
of course.
Another thing I would like is a concave hull, for want of a better name. As
well as shapes it has to encompass it would also have a list of shapes to
avoid. It would work like difference in that the first child is all the
positive shapes on the inside and the rest are negative shapes on the
outside.
E.g.
concave_hull() {
hull()
for(x = [-10,10], y = [-10,10], z = [0, 20])
translate([x,y, z])
sphere(2);
translate([0, 0, 18])
sphere(5);
}
Would make cube with rounded corners with a depression in the top that had
a rounded bottom. Imaging a balloon skin wrapped over 8 spheres with a
ninth resting on top. It is hard to make these sorts of shapes, even in 2D
as you have to calculate tangents to circles from other circles.
On 10 November 2015 at 15:33, doug moen doug@moens.org wrote:
I think that the underlying topic of discussion is: polyhedron() is
difficult to use. Is there an easier way to convert a collection of
vertices into a 3D object?
Wolf has explored the idea of gluing a cloud of non-manifold objects into
a polyhedron using hull(). It relies on passing an invalid argument list to
polyhedron(), and relying on the fact that you don't currently get an
error. Worse, this technique is not general, since it can't be used to
construct a non-convex object. It's also much slower than directly
constructing your object with a single call to polyhedron().
Peter Falke has suggested the idea of feeding a collection of points to
hull(). I don't think there's any way to do that right now. But it's an
interesting suggestion, since specifying a point cloud is easier to do than
specifying a disconnected cloud of faces (as in Wolf's code), which in turn
is easier than specifying a connected set of faces (ie, the arguments to
polyhedron()).
The raw output from a 3D scanner is a point cloud. There exists software
for converting this point cloud into a polyhedral mesh. I think it would be
interesting to add a point_cloud() operation to OpenSCAD, for converting a
list of vertices into a manifold 3D object. The algorithm should exist
somewhere as open source. It's probably slower than polyhedron(), but much
easier to use.
The point_cloud() primitive would give us very simple and easy to write
code for generating an ellipsoid. Something like this:
a=30; b=20; c=10; //half-axes of ellipse
Step=10;
point_cloud(
[for (v=[0: Step: 180])
for (u=[0: Step: 360])
P(u,v)
]);
function P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)];
On 10 November 2015 at 09:32, Peter Falke <
stempeldergeschichte@googlemail.com> wrote:
It is nice that hull() accepts a collection of non-manifold faces.
Does anyone know: would hull() also accept a collection of points as
inputs?
Even if you can not define a point in OpenSCAD, (yet).
2015-11-10 13:08 GMT+01:00 nop head nop.head@gmail.com:
Hmm, all the newlines got eaten but I have fixed it on the forum post.
On 10 November 2015 at 12:05, nophead nop.head@gmail.com wrote:
This is how you do it with list comprehensions to make a manifold
polyhedron that doesn't need wrapping in hull. a=30; b=20; c=10;
//half-axes of ellipse Step=10; function
P(u,v)=[a*cos(u)sin(v),bsin(u)sin(v),ccos(v)]; //point on the surface
of an ellipsoid function SurfaceElement(u,v) = let(hs = Step / 2) [ P(u -
hs, v - hs), P(u + hs, v - hs), P(u + hs, v + hs), P(u - hs, v + hs)];
function quad(i) = let(p = i * 4) [[p, p + 1, p + 2], [p, p + 2, p + 3]];
function flatten(l) = [ for (a = l) for (b = a) b ] ; elements =
flatten([let(s = Step / 2) for(v = [s : Step : 180 - s]) for(u = [s : Step:
360 - s]) SurfaceElement(u, v)]); faces = flatten([for(v = [0 : 180 / Step
View this message in context: Re: Polyhedron()
http://forum.openscad.org/Polyhedron-tp14338p14340.html
Sent from the OpenSCAD mailing list archive
http://forum.openscad.org/ at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org