Curved sides/lines

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

Curved sides/lines

Kevig
Hello everybody,

is there a way to make curved sides to a cube?
i don't mean circulair but more or less hyperbolic curves.

something like giving 3 or more points and let the naturally curve between
the point be calculated

<http://forum.openscad.org/file/t2834/curve.png>

or a formula to calculate

grts
henk



--
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: Curved sides/lines

acwest
There is a shape called a cuboid which is possibly something like what you are describing. I wrote an openscad module for them (I should update it, as I have better ways of doing it now) https://www.thingiverse.com/thing:3408435

On Wed, 7 Oct 2020, 03:54 Kevig, <[hidden email]> wrote:
Hello everybody,

is there a way to make curved sides to a cube?
i don't mean circulair but more or less hyperbolic curves.

something like giving 3 or more points and let the naturally curve between
the point be calculated

<http://forum.openscad.org/file/t2834/curve.png>

or a formula to calculate

grts
henk



--
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: Curved sides/lines

acwest
Actually, I think it's called a super-ellipsoid. I guess it's still too early for me. The parameters can be set to cover anything from a cube to a sphere to some rather off hyperbolic shapes

On Wed, 7 Oct 2020, 05:42 A. Craig West, <[hidden email]> wrote:
There is a shape called a cuboid which is possibly something like what you are describing. I wrote an openscad module for them (I should update it, as I have better ways of doing it now) https://www.thingiverse.com/thing:3408435

On Wed, 7 Oct 2020, 03:54 Kevig, <[hidden email]> wrote:
Hello everybody,

is there a way to make curved sides to a cube?
i don't mean circulair but more or less hyperbolic curves.

something like giving 3 or more points and let the naturally curve between
the point be calculated

<http://forum.openscad.org/file/t2834/curve.png>

or a formula to calculate

grts
henk



--
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: Curved sides/lines

cacb
In reply to this post by acwest
On 2020-10-07 11:42, A. Craig West wrote:
> There is a shape called a cuboid which is possibly something like what
> you are describing. I wrote an openscad module for them (I should
> update it, as I have better ways of doing it now)
> https://www.thingiverse.com/thing:3408435

That model has all the face normals pointing inwards....

Carsten Arnholm

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

Re: Curved sides/lines

adrianv
In reply to this post by Kevig
For the 2d case possibly the smooth_path module from BOSL2 does what you
want:  

https://github.com/revarbat/BOSL2/wiki/rounding.scad#smooth_path

It's based on beziers.  BOSL2 supports 3d beziers, but you'd have to work
out how to make the curved "faces" yourself.  I think it's not so easy to
make a general "polyhedron smoother".  


Kevig wrote

> Hello everybody,
>
> is there a way to make curved sides to a cube?
> i don't mean circulair but more or less hyperbolic curves.
>
> something like giving 3 or more points and let the naturally curve between
> the point be calculated
>
> &lt;http://forum.openscad.org/file/t2834/curve.png&gt; 
>
> or a formula to calculate
>
> grts
> henk
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
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: Curved sides/lines

Ronaldo


BOSL2 supports 3d beziers, but you'd have to work
out how to make the curved "faces" yourself.  I think it's not so easy to
make a general "polyhedron smoother". 

It is not so difficult either although laborious. You may define a trivariate polynomial deformation using Bezier and apply it to a refinement of the polyhedron. To find the appropriate control points of the deformation may be the painful step.


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

Re: Curved sides/lines

adrianv
I suppose if you take each face of the polyhedron (assume a convex
polyhedron) you could find the centerpoint and shift it away from the face,
and then triangulate.  This forms a pyramid.  Then each triangle could be
replaced by a degenerate bezier patch.  Presumably you'd want to match
derivatives along the edges, but it's not clear what boundary condition
would be desired at the base of the pyramid.  

This is a pretty complex endeavor and I think qualifies as "difficult".  
Maybe there's some way to keep things simpler?  


Ronaldo wrote

> BOSL2 supports 3d beziers, but you'd have to work
>> out how to make the curved "faces" yourself.  I think it's not so easy to
>> make a general "polyhedron smoother".
>>
>
> It is not so difficult either although laborious. You may define a
> trivariate polynomial deformation using Bezier and apply it to a
> refinement
> of the polyhedron. To find the appropriate control points of the
> deformation may be the painful step.





--
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: Curved sides/lines

Kevig
In reply to this post by Kevig
thanks you all,

you give me a good couple of pointers in the right direction.
i am going to try them and hopefully it is goig to work.

i let you know how it worked out

grts
h



--
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: Curved sides/lines

Ronaldo
In reply to this post by adrianv
I suppose if you take each face of the polyhedron (assume a convex
polyhedron) you could find the centerpoint and shift it away from the face,
and then triangulate.  This forms a pyramid.  Then each triangle could be
replaced by a degenerate bezier patch.  Presumably you'd want to match
derivatives along the edges, but it's not clear what boundary condition
would be desired at the base of the pyramid. 

This is a pretty complex endeavor and I think qualifies as "difficult". 
Maybe there's some way to keep things simpler? 

There is @adrianv. What I had suggested was a simple polyhedron deformation: each point of the polyhedron is mapped to a 3d point by a non-linear function. The non-linear function I propose is a trivariate polynomial function expressed in its Bezier form - a natural extension of the bivariate Bezier patch functions:

function Bezier_transform( cp, s, t, u) = ...

where the control point cp is a tridimensional array of 3d points and s, t, u are numbers. To avoid extrapolations in the polynomial transform, we should pre-apply a linear transform so that points in a domain of the 3d space (the polyhedron bounding box, for instance) are mapped to a subset of [0,1]X [0,1]X [0,1] . A simple form of it is just a scale:

function lmap(point, box) = ...

that maps points in a box = [[xmin,xmax], [ymin,ymax], [zmin,zmax]]  to points in  [0,1]X [0,1]X [0,1].

Now, each vertex v of the polyhedron (supposed to be in a vnf form) is transformed by the composition of lmap and Bezier_transform :

new_vertices = 
   [for( v = vertex(polyhedron) )
       let( w = lmap(v, bbox(polyhedron))) )
       Bezier_transform(cp, w[0], w[1], w[2])
    ];

The set of the previously refined polyhedron faces are kept unchanged.

That kind of deformation will in general produce smooth curved faces (for the original polyhedron facet) and smooth curved edges (for the original polyhedron edges) but will not have a smooth transition from a curved face to an adjacent one. The new shape will have wrinkles at the edges.

I don't expect a very fast processing with that but it is simple to code and very general.


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

Re: Curved sides/lines

adrianv
I suspect that most readers would not consider this approach "simple".  As
far as I can tell, it is also not  general.  That is, it would work ok to
producing a bulging cube (which satisfies the original query), but that's
all.  Suppose that the cube is simply the cube occupying [0,1]^3.  Then it
is clear how to choose the control points to result in the desired bulge:
You create a 3x3x3 array of control points marking the corners of the cube
and the edge and face centers, and then you shift out the face centers.
Sampling the resulting bezier on the cube faces should produce the desired
bulging cube, where the original cube edges are preserved but the faces
bulge.  

I found it easier to think about this in 2d for the square (where
implementations exist).  And then it is easy so see the struggle that
arises: if I wish to produce a bulging triangle or bulging pentagon, now
what?  The triangle can perhaps be achieved using a degenerate patch or a
triangular bezier patch.  But how can one approach the pentagon or hexagon?
I'm not sure how to preserve the vertices of the original shape because the
bezier map only has 4 points that actually map to the control points.   In
3-space if I want to create a bulging octahedron or dodecahedron, it is not
at all clear how to select control points that might do the job for the same
reason.  How can I preserve the original polyhedron edges?  It seems like I
can only produce a cube-style inflation that moves the shape outwards from
its center in each of the coordinate axis directions.  This will break the
symmetry of the original polyhedron and it will not preserve edges.  Have I
overlooked a simple answer?


Ronaldo wrote

>>
>> I suppose if you take each face of the polyhedron (assume a convex
>> polyhedron) you could find the centerpoint and shift it away from the
>> face,
>> and then triangulate.  This forms a pyramid.  Then each triangle could be
>> replaced by a degenerate bezier patch.  Presumably you'd want to match
>> derivatives along the edges, but it's not clear what boundary condition
>> would be desired at the base of the pyramid.
>>
>> This is a pretty complex endeavor and I think qualifies as "difficult".
>> Maybe there's some way to keep things simpler?
>>
>
> There is @adrianv. What I had suggested was a simple polyhedron
> deformation: each point of the polyhedron is mapped to a 3d point by a
> non-linear function. The non-linear function I propose is a trivariate
> polynomial function expressed in its Bezier form - a natural extension of
> the bivariate Bezier patch functions:
>
> function Bezier_transform( cp, s, t, u) = ...
>
> where the control point cp is a tridimensional array of 3d points and s,
> t,
> u are numbers. To avoid extrapolations in the polynomial transform, we
> should pre-apply a linear transform so that points in a domain of the 3d
> space (the polyhedron bounding box, for instance) are mapped to a subset
> of
> [0,1]X [0,1]X [0,1] . A simple form of it is just a scale:
>
> function lmap(point, box) = ...
>
> that maps points in a box = [[xmin,xmax], [ymin,ymax], [zmin,zmax]]  to
> points in  [0,1]X [0,1]X [0,1].
>
> Now, each vertex v of the polyhedron (supposed to be in a vnf form) is
> transformed by the composition of lmap and Bezier_transform :
>
> new_vertices =
>    [for( v = vertex(polyhedron) )
>        let( w = lmap(v, bbox(polyhedron))) )
>        Bezier_transform(cp, w[0], w[1], w[2])
>     ];
>
> The set of the previously refined polyhedron faces are kept unchanged.
>
> That kind of deformation will in general produce smooth curved faces (for
> the original polyhedron facet) and smooth curved edges (for the original
> polyhedron edges) but will not have a smooth transition from a curved face
> to an adjacent one. The new shape will have wrinkles at the edges.
>
> I don't expect a very fast processing with that but it is simple to code
> and very general.
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org