discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Is there a "Polar" translate transformation?

BL
Bryan Lee
Mon, Aug 15, 2022 4:48 AM

Yes.

(Note:  Not syntax validated in openscad, but the principle should work.)

If I'm understanding the questions correctly:

// Create a cube 22 units from the origin at an angle of 55 degrees,
// also maintain the cube's "natural" orientation to the axies.
// You might need to use negative my_angle if the rotations are in the wrong direction

my_angle=55;
my_distance=22;

rotate([0,0,my_angle]) //rotate it my angle degrees around the Z axis
translate([my_distance,0,0]) //move my_distance from origin
rotate([0,0,-my_angle]) //maintain orientation relative to axies (this is optional)
cube([1,1,1]);

Thus William Lugg via Discuss hast written on Mon, Aug 15, 2022 at 03:18:37AM +0000, and, according to prophecy, it shall come to pass that:

Date: Mon, 15 Aug 2022 03:18:37 +0000
From: William Lugg luggw1@protonmail.com
To: Jan Öhman via Discuss discuss@lists.openscad.org
Subject: [OpenSCAD] Is there a "Polar" translate transformation?

I have a situation where it would be helpful to be able to specify a
transformation as a distance and a direction, say as a rotation about
the Z axis from the positive X axis, for example.  Is there such a tool
in OpenSCAD?

I looked on the cheat sheet and one didn't pop out at me, but I wondered
if I might have missed it.

Thanks
Bill Lugg


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Yes. (Note: Not syntax validated in openscad, but the principle should work.) If I'm understanding the questions correctly: // Create a cube 22 units from the origin at an angle of 55 degrees, // also maintain the cube's "natural" orientation to the axies. // You might need to use negative my_angle if the rotations are in the wrong direction my_angle=55; my_distance=22; rotate([0,0,my_angle]) //rotate it my angle degrees around the Z axis translate([my_distance,0,0]) //move my_distance from origin rotate([0,0,-my_angle]) //maintain orientation relative to axies (this is optional) cube([1,1,1]); Thus William Lugg via Discuss hast written on Mon, Aug 15, 2022 at 03:18:37AM +0000, and, according to prophecy, it shall come to pass that: > Date: Mon, 15 Aug 2022 03:18:37 +0000 > From: William Lugg <luggw1@protonmail.com> > To: Jan Öhman via Discuss <discuss@lists.openscad.org> > Subject: [OpenSCAD] Is there a "Polar" translate transformation? > > I have a situation where it would be helpful to be able to specify a > transformation as a distance and a direction, say as a rotation about > the Z axis from the positive X axis, for example.  Is there such a tool > in OpenSCAD? > > I looked on the cheat sheet and one didn't pop out at me, but I wondered > if I might have missed it. > > Thanks > Bill Lugg > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
WL
William Lugg
Mon, Aug 15, 2022 2:53 PM

Thanks for all the responses.  For my application, it looks like Mr.
Lee's approach is going to work.  In my initial attempt, I had the
rotate and translate operations reversed and was getting results I
didn't want.  I had worked out the trig I needed to get to where I
wanted, but it was going to become very complicated for some of the work
I was going to have to do. This will simplify things greatly.

Thanks again.
Bill Lugg

On 8/14/22 22:48, Bryan Lee wrote:

Yes.

(Note:  Not syntax validated in openscad, but the principle should work.)

If I'm understanding the questions correctly:

// Create a cube 22 units from the origin at an angle of 55 degrees,
// also maintain the cube's "natural" orientation to the axies.
// You might need to use negative my_angle if the rotations are in the wrong direction

my_angle=55;
my_distance=22;

rotate([0,0,my_angle]) //rotate it my angle degrees around the Z axis
translate([my_distance,0,0]) //move my_distance from origin
rotate([0,0,-my_angle]) //maintain orientation relative to axies (this is optional)
cube([1,1,1]);

Thus William Lugg via Discuss hast written on Mon, Aug 15, 2022 at 03:18:37AM +0000, and, according to prophecy, it shall come to pass that:

Date: Mon, 15 Aug 2022 03:18:37 +0000
From: William Lugg luggw1@protonmail.com
To: Jan Öhman via Discuss discuss@lists.openscad.org
Subject: [OpenSCAD] Is there a "Polar" translate transformation?

I have a situation where it would be helpful to be able to specify a
transformation as a distance and a direction, say as a rotation about
the Z axis from the positive X axis, for example.  Is there such a tool
in OpenSCAD?

I looked on the cheat sheet and one didn't pop out at me, but I wondered
if I might have missed it.

Thanks
Bill Lugg


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Thanks for all the responses.  For my application, it looks like Mr. Lee's approach is going to work.  In my initial attempt, I had the rotate and translate operations reversed and was getting results I didn't want.  I had worked out the trig I needed to get to where I wanted, but it was going to become very complicated for some of the work I was going to have to do. This will simplify things greatly. Thanks again. Bill Lugg On 8/14/22 22:48, Bryan Lee wrote: > Yes. > > (Note: Not syntax validated in openscad, but the principle should work.) > > If I'm understanding the questions correctly: > > > // Create a cube 22 units from the origin at an angle of 55 degrees, > // also maintain the cube's "natural" orientation to the axies. > // You might need to use negative my_angle if the rotations are in the wrong direction > > > my_angle=55; > my_distance=22; > > rotate([0,0,my_angle]) //rotate it my angle degrees around the Z axis > translate([my_distance,0,0]) //move my_distance from origin > rotate([0,0,-my_angle]) //maintain orientation relative to axies (this is optional) > cube([1,1,1]); > > > > Thus William Lugg via Discuss hast written on Mon, Aug 15, 2022 at 03:18:37AM +0000, and, according to prophecy, it shall come to pass that: >> Date: Mon, 15 Aug 2022 03:18:37 +0000 >> From: William Lugg <luggw1@protonmail.com> >> To: Jan Öhman via Discuss <discuss@lists.openscad.org> >> Subject: [OpenSCAD] Is there a "Polar" translate transformation? >> >> I have a situation where it would be helpful to be able to specify a >> transformation as a distance and a direction, say as a rotation about >> the Z axis from the positive X axis, for example.  Is there such a tool >> in OpenSCAD? >> >> I looked on the cheat sheet and one didn't pop out at me, but I wondered >> if I might have missed it. >> >> Thanks >> Bill Lugg >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org