missing features

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

missing features

nate_lastname
Why doesn't OpenSCAD include these features:

A) Points as a primitive geometric figure
B) A convex hull operation (not minkowski sum)

These would come in handy for doing things like constructing a simplex or a
skewed pyramid



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: missing features

doug.moen
Convex hull is called "hull".
To construct a skewed pyramid or tetrahedron (3D simplex) from points, use "polyhedron".

On Sat, Oct 3, 2020, at 7:56 PM, nate_lastname wrote:

> Why doesn't OpenSCAD include these features:
>
> A) Points as a primitive geometric figure
> B) A convex hull operation (not minkowski sum)
>
> These would come in handy for doing things like constructing a simplex or a
> skewed pyramid
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: missing features

nate_lastname
> Convex hull is called "hull".

I see. Still, I wonder why points are not a primitive shape in OpenScad.

> To construct a skewed pyramid or tetrahedron (3D simplex) from points, use
> "polyhedron".

The problem with the polyhedron command is that it is hard to use since it
depends on the order in which the points are passed. Maybe it works that way
because OpenSCAD loads the points directly into an OpenGL vertex buffer.
Converting the vertices of a convex solid to something that OpenGL can
render is a nontrivial problem. (am I correct?)

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. Theoretically, would it be
possible to add points to OpenSCAD?



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: missing features

Ronaldo
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] ] );


Em dom., 4 de out. de 2020 às 03:46, nate_lastname <[hidden email]> escreveu:
> Convex hull is called "hull".

I see. Still, I wonder why points are not a primitive shape in OpenScad.

> To construct a skewed pyramid or tetrahedron (3D simplex) from points, use
> "polyhedron".

The problem with the polyhedron command is that it is hard to use since it
depends on the order in which the points are passed. Maybe it works that way
because OpenSCAD loads the points directly into an OpenGL vertex buffer.
Converting the vertices of a convex solid to something that OpenGL can
render is a nontrivial problem. (am I correct?)

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. Theoretically, would it be
possible to add points to OpenSCAD?



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

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: missing features

caterpillar
In reply to this post by nate_lastname
> I see. Still, I wonder why points are not a primitive shape in OpenScad.

What's the shape of a point? In math, a point has a definite position, but
it does not have any length, breadth or thickness.

If you want a mark denotes the existence of a point, you can define your own
one. For example, a circle denotes a 2D point.

module point2D(x, y, r = 1) {
    translate([x, y])
        circle(r);
}

point2D(10, 20);




-----
https://openhome.cc
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: missing features

JordanBrown
On 10/3/2020 9:33 PM, caterpillar wrote:
What's the shape of a point? In math, a point has a definite position, but it does not have any length, breadth or thickness.

Sure it does.  It has a length, breadth, and thickness of zero.

It's a lot like sphere(0.00000001), but even smaller.  But you could probably use that or cube(0.0000001) as an approximation to a point.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: missing features

Troberg
In reply to this post by caterpillar
caterpillar wrote
> What's the shape of a point? In math, a point has a definite position, but
> it does not have any length, breadth or thickness.

Well, a point (and, for that matter, a line) doesn't have any volume, but it
does have a position. It may not be that useful in itself, but it (or a
line) can be a very useful tool in creating other objects.

OpenSCAD has 2D objects, they don't have a volume, but are very useful for
creating 3D objects.

Also, remember that not all OpenSCAD users use it for 3D printing. I use it
for so diverse uses as furniture design, laser cutting, board game designs
and so on. I use 2D objects a lot (for laser cutting, it's all 2D, though
sometimes extruded to see fit of boxes and so on), and I would definitely
find both line (and related objects, such as curves) and point very useful.
Sure, I can do a line as a very thin box, but then the laser cutter will run
the line twice, as there is actually two lines, and it'll overburn the ends
slightly.



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: missing features

caterpillar
In reply to this post by JordanBrown
> It's a lot like sphere(0.00000001), but even smaller.  But you could
probably use that or cube(0.0000001) as an approximation to a point.

If you just want an approximation to a point with a customizable shape, this
might solve it.

$fn = 96;
module point(x = 0, y = 0, z = 0) {
    translate([x, y, z])
        children();
}

point(10, 20)
     circle(0.000001);

point(10, 20, 30)
     sphere(0.000001);



-----
https://openhome.cc
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: missing features

caterpillar
In reply to this post by Troberg
> Sure, I can do a line as a very thin box, but then the laser cutter will
run
the line twice, as there is actually two lines, and it'll overburn the ends
slightly.

Sorry, I don't know laser cutting. Maybe I'm wrong, it sounds like a path (a
list of points) supported by laser cutting, not a shape.



-----
https://openhome.cc
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: missing features

caterpillar
This post was updated on .
In reply to this post by Ronaldo
> 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 looks like a nice workaround.

My 2D version:

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

module hull_points2D(pts) {
    polygon(convex_hull2(pts));
}

hull_points2D([[0, 0], [0, 1], [1, 0], [3, 0]]);



-----
https://openhome.cc
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: missing features

cacb
In reply to this post by Ronaldo
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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|

Re: missing features

tp3
In reply to this post by nate_lastname
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: missing features

nophead
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 <[hidden email]> 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
[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
Reply | Threaded
Open this post in threaded view
|

Re: missing features

mondo
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?
>

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: missing features

caterpillar
This post was updated on .
In reply to this post by cacb
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/

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