Issue with gradual rotation of modules

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

Issue with gradual rotation of modules

thesurveyer
Hey there, I'm trying to create a program which lets you create dynamic surfaces with various inputs.
The program works by going through a for loop for both rows and cols, and for each shape giving it various modifiers like color, translates, and rotation. Currently I'm trying to allow "gradual rotation" of modules, so that they curve outwards or inwards from the center of the shape. The issue I'm having is I cannot figure out how to get them to rotate in place. If I rotate the modules before they are translated it looks like this:
If I rotate the modules after they are translated it looks like this:
Both of these are incorrect. I would like the modules to rotate in place. The second image shows that something weird is happening with the rotation, where the modules to the left are not being rotated the same as the modules on the right. The values given to the rotation are correct, and are (-20,-10,0,10,20). Here is the code that I'm using to call the module: The line in question is "rotate([gradXRotate,0,0])". Ignore the other rotates as they're used for another part of the program.
If I could get some help with this, that'd be great, i've been stuck on this problem for a long time. If you need any more information about how the rest of the program works, feel free to ask. Thanks!

Sent from the OpenSCAD mailing list archive at Nabble.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: Issue with gradual rotation of modules

nophead
Rotation is always around the origin. To rotate around a point on an object translate your object so that point is at the origin, rotate it and then translate it back to where you want it.

On 8 October 2017 at 04:44, thesurveyer <[hidden email]> wrote:
Hey there, I'm trying to create a program which lets you create dynamic surfaces with various inputs.
The program works by going through a for loop for both rows and cols, and for each shape giving it various modifiers like color, translates, and rotation. Currently I'm trying to allow "gradual rotation" of modules, so that they curve outwards or inwards from the center of the shape. The issue I'm having is I cannot figure out how to get them to rotate in place. If I rotate the modules before they are translated it looks like this:
If I rotate the modules after they are translated it looks like this:
Both of these are incorrect. I would like the modules to rotate in place. The second image shows that something weird is happening with the rotation, where the modules to the left are not being rotated the same as the modules on the right. The values given to the rotation are correct, and are (-20,-10,0,10,20). Here is the code that I'm using to call the module: The line in question is "rotate([gradXRotate,0,0])". Ignore the other rotates as they're used for another part of the program.
If I could get some help with this, that'd be great, i've been stuck on this problem for a long time. If you need any more information about how the rest of the program works, feel free to ask. Thanks!

Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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