Centre of origin

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
videodv
Posts: 69
Joined: Tue Feb 08, 2011 1:17 am

Centre of origin

Post by videodv »

When working out where to put points where is the origin to start from, is it the centre of the document (centre of origin) or top/bottom left/right

Also how do you workout the document size so any points are placed in the correct location.

Many Thanks
Breinmeester
Posts: 306
Joined: Thu May 13, 2010 6:01 am

Post by Breinmeester »

Yeah, some clarity on that is needed.
As far as i figured, 0,0 is at the exact centre of a layer. The anchor point has its own x and y location, so the point of origin is not depending on its location. The x and y axis are set as a ratio. Meaning that which ever is shorter is 1 unit big and the other is matched accordingly depending on your resolution in the project settings. So if the document is 400x400 x=1 wide and y=1 high. If it's 200x200 same thing. If it's 400x200 x=2 units wide and y=1 unit high.

That's all i know.
User avatar
hayasidist
Posts: 3876
Joined: Wed Feb 16, 2011 11:12 am
Location: Kent, England

Post by hayasidist »

what Breinmeester says is right if you have the defaults (zoom=60 and camera at x=0,y=0, z=1.732; vector layer at z=0). but there's a dependence on zoom and (relative) camera z too.

here's the maths: the zoom is the angle of view (the angle from the camera point to the top and bottom of frame - assuming that's the shortest). so half the height of the frame is tan(half the zoom angle)*(cameraZ-vectorZ). in the default that's tan(30)*1.732. tan(30) is 1/(sqrt(3); 1.732 is sqrt(3); so half height = exactly 1. That's Y(max); and Y(min) is - that. multiply by aspect ratio for X(max) and X(min).
if you change the zoom or the relative z then the coords of render area top/bottom/left/right change.

I'll leave you to figure out what happens if you pan /tilt / track the camera. :wink:
videodv
Posts: 69
Joined: Tue Feb 08, 2011 1:17 am

Post by videodv »

Thanks guys will be looking at this over the weekend

thanks to you both I have a point of refference I can now work from.

Cheers
videodv
Posts: 69
Joined: Tue Feb 08, 2011 1:17 am

Post by videodv »

Thanks guys

I have got all that worked out and now able to put points on screen/layer where ever I wish.

Regards
videodv
Posts: 69
Joined: Tue Feb 08, 2011 1:17 am

Post by videodv »

Just a quick update I now have my first fully working script with a dialog box to change various parameters working, just need to workout how to use the colour swatch to change shape colour to finish.

Thanks for all the help
Regards
Post Reply