What are the rules for transform()

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

What are the rules for transform()

DanS
I'm having some issues with transform()

If I do something simple (like in arches() below), I get a 3D shape,  But if I try to use points along a curve in the X Z plane (arches2()) I get nothing.  The curve and the points look legitimate to me
----------------------------- DEBUGGING OUTPUT FROM arches2()-------------------------------------------

ECHO: [[325, 0, 0], [324.796, 0, 15.6943], [324.183, 0, 31.3781], [323.162, 0, 47.0405], [321.734, 0, 62.6711], [319.9, 0, 78.2592], [317.661, 0, 93.7943], [315.018, 0, 109.266], [311.973, 0, 124.663], [308.528, 0, 139.976], [304.687, 0, 155.195], [300.45, 0, 170.308], [295.821, 0, 185.305], [290.804, 0, 200.178], [285.401, 0, 214.914], [279.617, 0, 229.505], [273.455, 0, 243.94], [266.919, 0, 258.21], [260.014, 0, 272.306], [252.744, 0, 286.216], [245.115, 0, 299.933], [237.131, 0, 313.447], [228.799, 0, 326.748], [220.123, 0, 339.828], [211.109, 0, 352.677], [201.764, 0, 365.288], [192.094, 0, 377.651], [182.106, 0, 389.758], [171.806, 0, 401.601], [149.454, 0, 426.029], [138.084, 0, 439.221], [127.102, 0, 452.737], [116.518, 0, 466.566], [106.339, 0, 480.697], [96.574, 0, 495.117], [87.232, 0, 509.815], [78.3204, 0, 524.777], [69.8469, 0, 539.992], [61.8185, 0, 555.446], [54.242, 0, 571.127], [47.1238, 0, 587.021], [40.4699, 0, 603.114], [34.2859, 0, 619.395], [28.5769, 0, 635.848], [23.3478, 0, 652.459], [18.6031, 0, 669.215], [14.3467, 0, 686.102], [10.5821, 0, 703.106], [7.31263, 0, 720.211], [4.54097, 0, 737.405], [2.26945, 0, 754.671], [0.5, 0, 771.996], [0.5, 0, 771.996], [0, 0, 777.711], [-0.5, 0, 771.996], [-2.26945, 0, 754.671], [-4.54097, 0, 737.405], [-7.31263, 0, 720.211], [-10.5821, 0, 703.106], [-14.3467, 0, 686.102], [-18.6031, 0, 669.215], [-23.3478, 0, 652.459], [-28.5769, 0, 635.848], [-34.2859, 0, 619.395], [-40.4699, 0, 603.114], [-47.1238, 0, 587.021], [-54.242, 0, 571.127], [-61.8185, 0, 555.446], [-69.8469, 0, 539.992], [-78.3204, 0, 524.777], [-87.232, 0, 509.815], [-96.574, 0, 495.117], [-106.339, 0, 480.697], [-116.518, 0, 466.566], [-127.102, 0, 452.737], [-138.084, 0, 439.221], [-149.454, 0, 426.029], [-161.201, 0, 413.173], [-171.806, 0, 401.601], [-182.106, 0, 389.758], [-192.094, 0, 377.651], [-201.764, 0, 365.288], [-211.109, 0, 352.677], [-220.123, 0, 339.828], [-228.799, 0, 326.748], [-237.131, 0, 313.447], [-245.115, 0, 299.933], [-252.744, 0, 286.216], [-260.014, 0, 272.306], [-266.919, 0, 258.21], [-273.455, 0, 243.94], [-279.617, 0, 229.505], [-285.401, 0, 214.914], [-290.804, 0, 200.178], [-295.821, 0, 185.305], [-300.45, 0, 170.308], [-304.687, 0, 155.195], [-308.528, 0, 139.976], [-311.973, 0, 124.663], [-315.018, 0, 109.266], [-317.661, 0, 93.7943], [-319.9, 0, 78.2592], [-321.734, 0, 62.6711], [-323.162, 0, 47.0405], [-324.183, 0, 31.3781], [-324.796, 0, 15.6943], [-325, 0, 0]]

ECHO: "blah"

ECHO: [304.687, 0, 155.195]



--------------------------------------------------------------------------------------------------------------------------

function waveOut(i) = abs(sin(i)) * romanArch(65, 3, 70, 200) + (1 - abs(sin(i))) * ogeepoly(65,3,60,60,200,1,10);


function waveIn(i) = abs(sin(i)) * romanArch(95, 3, 40, 200) + (1 - abs(sin(i))) * ogeepoly(65,3,60,60,200,1,10);

module arches() {
    
    skin([
           for (i=[0 : 180])
transform(translation([0,0,(i*0.5)]) * rotation([0,0,0]), waveOut(i))
]);
           
    translate([0,0,90]) {
        skin([
           for (i=[0 : 180])
transform(translation([0,0,(i*0.5)]) * rotation([0,0,0]), waveIn(i))
]);
    }       
    /*

           for (i=[0 : 90])
transform(translation([0,0,(i*0.5)]) * rotation([0,0,0]), interpolateWave(romanArch(70, 3, 62, 200), ogeepoly(65,3,60,60,100,1,10), i ))
]);*/
}


module arches2() {
    
    yxzpath = ogeepolyPath(650, 3, 600, 600, 210, 1, 10);
    
    echo(yxzpath);
    echo("blah");
    echo(yxzpath[10]);
    
    skin([
           for (i=[1 : 30]) 
transform(translation(yxzpath[i]) * rotation([0,0,0]), waveOut(i*6))
]);   
}
    
    //arches();

arches2();

Virus-free. www.avast.com

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

Re: What are the rules for transform()

Ronaldo
I'm having some issues with transform() 
If I do something simple (like in arches() below), I get a 3D shape,  But if I try to use points along a curve in the X Z plane (arches2()) I get nothing.  The curve and the points look legitimate to me 

I guess you are referring to the function transform() defined in transformations.scad as part of scad-utils. This function have two parameters: the first one is a 4x4 matrix and the former is a list of 3D points. To apply transform() to 2D points you must embed them in 3D with function to_3d that accepts a list of 2D points and return a list of 3D points, like in:

my3Dtransformedpoints = transform(matrix, to_3d(my2Dpoints))


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

Re: What are the rules for transform()

DanS
Yes I'm referring to scad-utils transform

I'm confused because this works fine:

         transform(translation([0,0,(i*0.5)]) * rotation([0,0,0]), waveOut(i))

and this does not

          transform(translation(yxzpath[i]) * rotation([0,0,0]), waveOut(i*6))

and when I do  the debugging output and grab a random yxzpath member it looks like a standard 3 element matrix (just like the first example)


[304.687, 0, 155.195]

On Tue, Mar 6, 2018 at 7:00 PM, Ronaldo Persiano <[hidden email]> wrote:
I'm having some issues with transform() 
If I do something simple (like in arches() below), I get a 3D shape,  But if I try to use points along a curve in the X Z plane (arches2()) I get nothing.  The curve and the points look legitimate to me 

I guess you are referring to the function transform() defined in transformations.scad as part of scad-utils. This function have two parameters: the first one is a 4x4 matrix and the former is a list of 3D points. To apply transform() to 2D points you must embed them in 3D with function to_3d that accepts a list of 2D points and return a list of 3D points, like in:

my3Dtransformedpoints = transform(matrix, to_3d(my2Dpoints))


_______________________________________________
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: What are the rules for transform()

Ronaldo
So, the trouble isn't the transform() call but the translation(). It requires the same parameter as translate(), that is, just a 3d vector and not a list of vectors.

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

Re: What are the rules for transform()

DanS

I'm having another issue now. I can get something to render fine if I do "arches2()", but if I do "difference, mirror; mirror" I get some odd error.


I am doing that because I have two shapes that overlap somewhat, so I subtract the overlap, then put the shape back in.



difference() { arches2(); mirror([0,0,1]) { arches2(); } } mirror([0,0,1]) { arches2(); }



Rendering Polygon Mesh using CGAL...

ERROR: CGAL error in CGALUtils::applyBinaryOperator difference: CGAL ERROR: assertion violation! Expr: itl != it->second.end() File: /opt/mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_3/SNC_external_structure.h Line: 1152

ERROR: CGAL error in CGALUtils::applyBinaryOperator union: CGAL ERROR: assertion violation! Expr: itl != it->second.end() File: /opt/mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_3/SNC_external_structure.h Line: 1152

Geometries in cache: 5

Geometry cache size in bytes: 12079904

CGAL Polyhedrons in cache: 2

CGAL cache size in bytes: 53351536

Total rendering time: 0 hours, 5 minutes, 49 seconds

Rendering finished.



Virus-free. www.avast.com

On Wed, Mar 7, 2018 at 5:12 PM, Ronaldo Persiano <[hidden email]> wrote:
So, the trouble isn't the transform() call but the translation(). It requires the same parameter as translate(), that is, just a 3d vector and not a list of vectors.

_______________________________________________
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: What are the rules for transform()

Ronaldo

I can get something to render fine if I do "arches2()", but if I do "difference, mirror; mirror" I get some odd error.


In cases like that, we suspect the object in question is not a manifold. So check if arches2() is a manifold. 

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

Re: What are the rules for transform()

DanS
What do I do to check if it is manifold or not?

Virus-free. www.avast.com

On Thu, Mar 8, 2018 at 6:33 AM, Ronaldo Persiano <[hidden email]> wrote:

I can get something to render fine if I do "arches2()", but if I do "difference, mirror; mirror" I get some odd error.


In cases like that, we suspect the object in question is not a manifold. So check if arches2() is a manifold. 

_______________________________________________
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: What are the rules for transform()

Ronaldo

What do I do to check if it is a manifold or not? 

If you are using polyhedron to build arches2 (), check if each edge are common to exactly 2 facets and that you have face winding order consistent to what is prescribed in the OpenSCAD manual. 

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

Re: What are the rules for transform()

nophead
Or just union it with a unit cube and see if CGAL throws an error.

On 8 March 2018 at 14:52, Ronaldo Persiano <[hidden email]> wrote:

What do I do to check if it is a manifold or not? 

If you are using polyhedron to build arches2 (), check if each edge are common to exactly 2 facets and that you have face winding order consistent to what is prescribed in the OpenSCAD manual. 

_______________________________________________
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