discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

missing features

CA
Carsten Arnholm
Sun, Oct 4, 2020 8:24 AM

On 04.10.2020 05:01, Ronaldo Persiano wrote:

This should work:

 module hull_points(pts) {
      hull() { polyhedron(pts, [[for(i=[0:len(pts)-1]) i]]); }
 }

 hull_points( [ [-1,-1,0], [-1,1,0], [1,1,0], [1,-1,0], [1/2,1,2] ] );

It works, but it is a work-around. The extra nonsensical for-loop is
required to fool polyhedron int accepting the data, but the polyhedron
is still an invalid one, and can only be used with the hull() operation.

Instead, one could do as nate_lastname suggested, support points and
allow a polyhedron be created from a point cloud and then interpreted as
a convex hull:

https://gist.github.com/arnholm/b21e8177683687aa642b20b939648f07

Carsten Arnholm

On 04.10.2020 05:01, Ronaldo Persiano wrote: > This should work: > > module hull_points(pts) { >     hull() { polyhedron(pts, [[for(i=[0:len(pts)-1]) i]]); } > } > > hull_points( [ [-1,-1,0], [-1,1,0], [1,1,0], [1,-1,0], [1/2,1,2] ] ); It works, but it is a work-around. The extra nonsensical for-loop is required to fool polyhedron int accepting the data, but the polyhedron is still an invalid one, and can only be used with the hull() operation. Instead, one could do as nate_lastname suggested, support points and allow a polyhedron be created from a point cloud and then interpreted as a convex hull: https://gist.github.com/arnholm/b21e8177683687aa642b20b939648f07 Carsten Arnholm
TP
Torsten Paul
Sun, Oct 4, 2020 11:12 AM

On 04.10.20 04:45, nate_lastname wrote:

In general, I suspect that it would be more elegant
to do a lot of things if it were possible to specify
a point in OpenSCAD. I'm really just curious if this
is a deliberate design choice or not.

I don't know the definitive answer to that, but I would
assume it was just not needed for the initial goal of
what OpenSCAD was supposed to do. As far as I know it
was not conceived specifically as a programming language
but as a tool to generate STL files for 3d printing
(and I guess that still shows).

Theoretically, would it be possible to add points to> OpenSCAD?

Yes, I think points (and also lines) as primitives
could work just fine as input for a list of dedicated
operations, e.g.

points -> hull -> 3d
points -> polygon -> 2d

ciao,
Torsten.

On 04.10.20 04:45, nate_lastname wrote: > In general, I suspect that it would be more elegant > to do a lot of things if it were possible to specify > a point in OpenSCAD. I'm really just curious if this > is a deliberate design choice or not. I don't know the definitive answer to that, but I would assume it was just not needed for the initial goal of what OpenSCAD was supposed to do. As far as I know it was not conceived specifically as a programming language but as a tool to generate STL files for 3d printing (and I guess that still shows). > Theoretically, would it be possible to add points to> OpenSCAD? Yes, I think points (and also lines) as primitives could work just fine as input for a list of dedicated operations, e.g. points -> hull -> 3d points -> polygon -> 2d ciao, Torsten.
NH
nop head
Sun, Oct 4, 2020 12:07 PM

Aren't point clouds used for general 3D shapes, e.g. from a scanner, so are
not necessarily convex? Presumably to convert them to a concave solid is
not straight forward and possible different algorithms can give different
results?

On Sun, 4 Oct 2020 at 12:13, Torsten Paul Torsten.Paul@gmx.de wrote:

On 04.10.20 04:45, nate_lastname wrote:

In general, I suspect that it would be more elegant
to do a lot of things if it were possible to specify
a point in OpenSCAD. I'm really just curious if this
is a deliberate design choice or not.

I don't know the definitive answer to that, but I would
assume it was just not needed for the initial goal of
what OpenSCAD was supposed to do. As far as I know it
was not conceived specifically as a programming language
but as a tool to generate STL files for 3d printing
(and I guess that still shows).

Theoretically, would it be possible to add points to> OpenSCAD?

Yes, I think points (and also lines) as primitives
could work just fine as input for a list of dedicated
operations, e.g.

points -> hull -> 3d
points -> polygon -> 2d

ciao,
Torsten.


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

Aren't point clouds used for general 3D shapes, e.g. from a scanner, so are not necessarily convex? Presumably to convert them to a concave solid is not straight forward and possible different algorithms can give different results? On Sun, 4 Oct 2020 at 12:13, Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 04.10.20 04:45, nate_lastname wrote: > > In general, I suspect that it would be more elegant > > to do a lot of things if it were possible to specify > > a point in OpenSCAD. I'm really just curious if this > > is a deliberate design choice or not. > > I don't know the definitive answer to that, but I would > assume it was just not needed for the initial goal of > what OpenSCAD was supposed to do. As far as I know it > was not conceived specifically as a programming language > but as a tool to generate STL files for 3d printing > (and I guess that still shows). > > > Theoretically, would it be possible to add points to> OpenSCAD? > > Yes, I think points (and also lines) as primitives > could work just fine as input for a list of dedicated > operations, e.g. > > points -> hull -> 3d > points -> polygon -> 2d > > ciao, > Torsten. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
RW
Ray West
Sun, Oct 4, 2020 1:31 PM

There has to be other information provided, apart from a list of xyz
coordinates. For example, if you use a digitising probe, you will know
that it does not give points on the underside of an object, so for
example if you have a cube, and you digitise points on the surface, then
those points will need to be treated differently compared to some other
scanning method, where they could represent corners of holes. Probing is
sometimes done in a sequence, (raster scanning), but not always. A
sequence can not be assumed, in general. Terrain  mapping would be easier.

On 04/10/2020 13:07, nop head wrote:

Aren't point clouds used for general 3D shapes, e.g. from a scanner,
so are not necessarily convex? Presumably to convert them to a concave
solid is not straight forward and possible different algorithms can
give different results?

There has to be other information provided, apart from a list of xyz coordinates. For example, if you use a digitising probe, you will know that it does not give points on the underside of an object, so for example if you have a cube, and you digitise points on the surface, then those points will need to be treated differently compared to some other scanning method, where they could represent corners of holes. Probing is sometimes done in a sequence, (raster scanning), but not always. A sequence can not be assumed, in general. Terrain  mapping would be easier. On 04/10/2020 13:07, nop head wrote: > Aren't point clouds used for general 3D shapes, e.g. from a scanner, > so are not necessarily convex? Presumably to convert them to a concave > solid is not straight forward and possible different algorithms can > give different results? >
C
caterpillar
Mon, Oct 5, 2020 6:29 AM

cacb wrote

Instead, one could do as nate_lastname suggested, support points and
allow a polyhedron be created from a point cloud and then interpreted as
a convex hull:

https://gist.github.com/arnholm/b21e8177683687aa642b20b939648f07

Carsten Arnholm


OpenSCAD mailing list

Discuss@.openscad

I tried to implement one in OpenSCAD.

use <experimental/polyhedron_hull.scad>;
//https://github.com/JustinSDK/dotSCAD/blob/master/src/experimental/polyhedron_hull.scad

pts = [
[1, 1, 1],
[1, 1, 0],
[-1, 1, 0],
[-1, -1, 0],
[1, -1, 0],
[0, 0, 1],
[0, 0, -1]
];

polyhedron_hull(pts);


https://openhome.cc

Sent from: http://forum.openscad.org/

cacb wrote > Instead, one could do as nate_lastname suggested, support points and > allow a polyhedron be created from a point cloud and then interpreted as > a convex hull: > > https://gist.github.com/arnholm/b21e8177683687aa642b20b939648f07 > > Carsten Arnholm > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org I tried to implement one in OpenSCAD. use <experimental/polyhedron_hull.scad>; //https://github.com/JustinSDK/dotSCAD/blob/master/src/experimental/polyhedron_hull.scad pts = [ [1, 1, 1], [1, 1, 0], [-1, 1, 0], [-1, -1, 0], [1, -1, 0], [0, 0, 1], [0, 0, -1] ]; polyhedron_hull(pts); ----- https://openhome.cc -- Sent from: http://forum.openscad.org/