# New features request: extractpolyhedron & extractmatrix

11 messages
Open this post in threaded view
|

## New features request: extractpolyhedron & extractmatrix

 It might be nice to be able to extract a polyhedron from a CSG object for additional processing. Here's the idea: newpolyhedron=extractpolyhedron(cube(10)); // newpolyhedron is a pair: [points,triangles] such that polyhedron(points=newpolyhedron[0],triangles=newpolyhedron[1]); // will reproduce the cube. --- Also, newmatrix=extractmatrix(translate([10,0,20]) rotate([0,45,0])); would produce a matrix suitable for use in 'multmatrix'. --- Alternatively, (& perhaps better) it would be nice to apply 'translate' and 'rotate' sequences to a list of points: newpoints=translate([10,0,20]) rotate([0,45,0]) [point0,point1,point2,...]; It is then possible to extract the matrix with the following data: newpoints=translate([10,0,20]) rotate([0,45,0]) [[0,0,0],[1,0,0],[0,1,0],[0,0,1]]; _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscadhttp://openscad.org - https://flattr.com/thing/121566
Open this post in threaded view
|

## Re: New features request: extractpolyhedron & extractmatrix

Open this post in threaded view
|

## Re: New features request: extractpolyhedron & extractmatrix

Open this post in threaded view
|

## Re: New features request: extractpolyhedron & extractmatrix

 I'm not that interested in cubes, per se.  I was simply using a cube as an example. I'm building a large polyhedron out of points & triangles. I'd like to transform some of the points for this polyhedron using one matrix, and other of the points using a different matrix. Applying a transformation to the entire polyhedron isn't what I need. Putting off the transformation until the entire structure is built isn't an option. Yes, I can build my own transformation matrices, but it's painful and I end up not being able to use all of the transformation machinery that OpenSCAD has already developed. It should be possible to describe to OpenSCAD a sequence of transformations -- e.g., translate, rotate, multmatrix, etc. -- and construct a single transformation matrix that I can use on sets of points. At 12:04 PM 6/29/2013, nop head wrote: >Why do you want to compute the scaled and rotated points of a cube? What do you do with them next? _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscadhttp://openscad.org - https://flattr.com/thing/121566
Open this post in threaded view
|

## Re: New features request: extractpolyhedron & extractmatrix

 The issue is translate(), rotate() etc work on a tree of geometry, not matrix expressions. There is currently no way to put geometry into expressions. I think you can write functions called translate(), rotate(), etc that return matrices and then multiply the results together to make the combined transformation to pass to multmatrix. Would that do what you want? On 30 June 2013 15:49, Henry Baker wrote: I'm not that interested in cubes, per se.  I was simply using a cube as an example. I'm building a large polyhedron out of points & triangles. I'd like to transform some of the points for this polyhedron using one matrix, and other of the points using a different matrix. Applying a transformation to the entire polyhedron isn't what I need. Putting off the transformation until the entire structure is built isn't an option. Yes, I can build my own transformation matrices, but it's painful and I end up not being able to use all of the transformation machinery that OpenSCAD has already developed. It should be possible to describe to OpenSCAD a sequence of transformations -- e.g., translate, rotate, multmatrix, etc. -- and construct a single transformation matrix that I can use on sets of points. At 12:04 PM 6/29/2013, nop head wrote: >Why do you want to compute the scaled and rotated points of a cube? What do you do with them next? _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad http://openscad.org - https://flattr.com/thing/121566 _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscadhttp://openscad.org - https://flattr.com/thing/121566
Open this post in threaded view
|

## Re: New features request: extractpolyhedron & extractmatrix

 Yes, I've done that, but it seems silly to constantly reinvent the wheel... The need to do duplicate all of this machinery points out a problem in the design of the language. At 12:56 PM 6/30/2013, nop head wrote: >I think you can write functions called translate(), rotate(), etc that return matrices and then multiply the results together to make the combined transformation to pass to multmatrix. Would that do what you want? _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscadhttp://openscad.org - https://flattr.com/thing/121566
Open this post in threaded view
|

## Re: New features request: extractpolyhedron & extractmatrix

 It only needs to be done once and put in a library. Better than inventing new syntax and complicating the language in my opinion.On 30 June 2013 21:47, Henry Baker wrote: Yes, I've done that, but it seems silly to constantly reinvent the wheel... The need to do duplicate all of this machinery points out a problem in the design of the language. At 12:56 PM 6/30/2013, nop head wrote: >I think you can write functions called translate(), rotate(), etc that return matrices and then multiply the results together to make the combined transformation to pass to multmatrix. Would that do what you want? _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad http://openscad.org - https://flattr.com/thing/121566 _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscadhttp://openscad.org - https://flattr.com/thing/121566
Open this post in threaded view
|

## Re: New features request: extractpolyhedron & extractmatrix

 Well, if you're going to do that, then you can simplify the language substantially by getting rid of scale, resize, rotate, translate, mirror, etc., in favor of your library + just multmatrix: multmatrix(m=translate([0,1,0])*rotate([60,0,0])) cube(10); At 02:07 PM 6/30/2013, nop head wrote: >It only needs to be done once and put in a library. Better than inventing new syntax and complicating the language in my opinion. _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscadhttp://openscad.org - https://flattr.com/thing/121566
Open this post in threaded view
|

## Re: New features request: extractpolyhedron & extractmatrix

 Yes but it is ugly for the common usage case, which is making objects by operation on solids, not building them from points.On 30 June 2013 22:37, Henry Baker wrote: Well, if you're going to do that, then you can simplify the language substantially by getting rid of scale, resize, rotate, translate, mirror, etc., in favor of your library + just multmatrix: multmatrix(m=translate([0,1,0])*rotate([60,0,0])) cube(10); At 02:07 PM 6/30/2013, nop head wrote: >It only needs to be done once and put in a library. Better than inventing new syntax and complicating the language in my opinion. _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad http://openscad.org - https://flattr.com/thing/121566 _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscadhttp://openscad.org - https://flattr.com/thing/121566