You may find it useful to use center=true when defining you objects. This
will place the center of all three dimension at the coordinate origin
[0,0,0].
However the general answer to you question is:
Example:
x= 5; y =8; z=10;
translate([5,-10,15]){ // move rotated object
rotate([0,0,30]){
translate([0,-x/2,0]){ // move rotation point to origin
cube([x,y,z]);
} } }
note that the the pairs of braces {} are not required but are shown here for
clarity of the scope of each operation.
--
View this message in context: http://forum.openscad.org/rotating-a-cube-around-the-center-of-the-y-axis-of-the-cube-tp3424p13590.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Oops. I had meant to use
translate([0,-y/2,0]) not x/2
But this shows that you can use any point location.
Even one outside the object will work.
--
View this message in context: http://forum.openscad.org/rotating-a-cube-around-the-center-of-the-y-axis-of-the-cube-tp3424p13591.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I don't understand that method.
if you wished to rotate the object around its centre - y=1, once the obect
is rotate you can find where the point y-1 is relative to the new rotation
of the object, using the object's orientation vector3, and then use that
minus the same point at it's previous rotation, to translate the point to
the rotatearound position. ?!?
--
View this message in context: http://forum.openscad.org/rotating-a-cube-around-the-center-of-the-y-axis-of-the-cube-tp3424p13613.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I don't understand your problem.
OpenScad rotate() is always around the origin. So you translate your object
so the point on it you want the rotation to be around is at the origin.
Then you rotate it. That point is still on the origin. Then you translate
it back to where it used to be. The end result is that point on the object
has not moved but the object has rotated about it.
On 26 August 2015 at 20:50, ufomorace ant.stewart@yahoo.com wrote:
I don't understand that method.
if you wished to rotate the object around its centre - y=1, once the obect
is rotate you can find where the point y-1 is relative to the new rotation
of the object, using the object's orientation vector3, and then use that
minus the same point at it's previous rotation, to translate the point to
the rotatearound position. ?!?
--
View this message in context:
http://forum.openscad.org/rotating-a-cube-around-the-center-of-the-y-axis-of-the-cube-tp3424p13613.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
ufomorace you are over thinking the problem.
If you move your object to place the center of rotation at the origin,
rotate it, then move it back by changing the sign on the x,y,z values used
for the first move, it is right back where it was, but rotated.
Nothing complicated about the math.
Yes, all the other points have a new location, but that is what you wanted.
If you now want it some where else, think about moving that center of
rotation.
--
View this message in context: http://forum.openscad.org/rotating-a-cube-around-the-center-of-the-y-axis-of-the-cube-tp3424p13621.html
Sent from the OpenSCAD mailing list archive at Nabble.com.