Script that rotates background image?
All  1-3  4-9

Previous
Next
 From:  Michael Gibson
8317.4 In reply to 8317.3 
Yup, background images are distinct from geometry objects, they can't go in an object list. The frame property like Max writes above is how they can be manipulated. Thanks Max!

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  mkdm
8317.5 In reply to 8317.3 
Hi Max!

Tanks a lot for the tip!

ASAP I'm going to write a commands with UI (?) ad I will include it in my scripts/commands toolbox.

See you!

- Marco (mkdm)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Martin (MARTIN3D)
8317.6 
Thanks a lot for the help!

-Martin
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Martin (MARTIN3D)
8317.7 
I need your help again:

The default rotation origin of the image frame is the lower left corner. How can I change this?
I want to rotate the center of the background image around MoIs 0,0,0 coordinate.

I found this in the Javascript documentation but it has no effect:
img.frame.newOriginX = img.width/2;
img.frame.newOriginY = img.height/2;

-Martin
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Max Smirnov (SMIRNOV)
8317.8 In reply to 8317.7 
Hi Martin,

this task is not easy :)
imp.frame specifies position of lower left corner of the image.

To rotate image around its center you need to find a central axis coordinates.
p0 = img.frame.evaluate(img.width/2, img.height/2, 0);
p1 = img.frame.evaluate(img.width/2, img.height/2, 1);

Then you need to rotate img.frame.origin, img.frame.xaxis and img.frame.yaxis points around this vector.
You can use google to find articles with titles like "Rotation about an arbitrary axis"

Also you can check my nodeeditor project. core/litegraph.js -> rotateAroundNormalizedVector function
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Martin (MARTIN3D)
8317.9 In reply to 8317.8 
Thank you Max for the tips.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-3  4-9