View Full Version : - Scaling Vectors?

09 September 2003, 06:21 AM
I have a bunch of 2D vectors, and I was wondering how to scale them up to fit perfectly within 0 to 1 space. I've found the bounding box for the selected points (the 2D vectors I want to scale), so I want the result to be the low bounding box value will be at (0, 0), while the high bounding box value will be at (1, 1). All the rest of the points will scale uniformly.

For those familiar with Maya, I want to do exactly what Normalize UVs does, basically.


09 September 2003, 07:42 AM
Making a Normalize UVs LScript for Lightwave ;)?

Say you have a bounding box with min/max uv coords (0.1, 0.2) and (0.3, 0.5). You translate the min coord to (0, 0) leaving you with new uv min/max box coords (0.0, 0.0) and (0.2, 0.3). Apply this translation to all your uv coords that need to be scaled as well.

So all u coords needs to be scaled by (1/0.2) = 5.
And all v coords need to be scaled by (1/0.3) = 3.3333.

And if you want to preserve the box's aspect ratio, you would scale all points by the minimum scaling factor, 3.3333. So my answer to your question is just a translation followed by scaling u and v values.

Hope that's what u want :). I don't know much about MEL or Maya :p.

09 September 2003, 08:21 AM
Actually, I think I've figured it out on my own.

Thx. anyway.

CGTalk Moderation
01 January 2006, 05:09 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.