PDA

View Full Version : Neato Math Trick: Scaling for Diagonals & Inclined objects (milkshape)


DarkRidePerson
06-15-2006, 06:21 PM
Hi all, I figured out a neat little trick for scaling something to the proper size if you want to make it diagonal. It makes it easier because it involves a lot less mouse work. You can just "type type type" stuff in and save. (This is in milkkshape btw)

Lets say that you want to create a tile or wall that is diagonal instead of straight. Well, how much do you scale it (in milkshape) so that the edge will be long enough to stretch across a tile?

well, a tile is a square, which is made of two right triangles. We want it to be as long as the hypotenuse, so we use a2 + b2 = c2
(the small numbers are exponents...)

in milkshape, an rct3 tile is 4 across and 4 long. 4 squared is 16, and 16 + 16 = 32. The aproximate square root of 32 is 5.65. So, we want our thing to stretch across 5.65 tiles.

But, how much do we scale it to do this?
for that, we use y=kx. y=5.65 and x=4 (k being the amount you scale it) solved, it lcomes out to 1.41

So, even though I didn't have to bother explaining the math, I did anyway (why? because... um... not sure really... I don't particularly like math all that much... )

The bottom line: If you want to make something be perfectly diagonal in milkshape, scale it by 1.41 (1.4 will work) and then rotate it by 45 degrees.

weasel497
06-15-2006, 06:39 PM
That's a good little formula, we learned about this in school but I never thought about applying it to custom scenery. I'll have to try this when my new my new computer gets here.

Thanks DRP!!!

Vodhin
06-15-2006, 07:57 PM
Well this comes at exactly the right time- i'ma bout to take all the string light pieces and make diagonal sections :D I'll try this on the wire...

What I had been doing is using a 6 sided cylinder for the diagonal walls (make for a perfect corner with straight walls, btw). I was just dragging the vertexes one at a time (well, two- I drag in the top view window) into place. If my walls are .05 thick (eg. I forget really) then I just make the extra vertexes line up at .025 away from the crosshairs of the grid.

I like your idea, though. It's definarely a great formula...

DarkRidePerson
06-15-2006, 08:03 PM
Well this comes at exactly the right time- i'ma bout to take all the string light pieces and make diagonal sections :D I'll try this on the wire...

What I had been doing is using a 6 sided cylinder for the diagonal walls (make for a perfect corner with straight walls, btw). I was just dragging the vertexes one at a time (well, two- I drag in the top view window) into place. If my walls are .05 thick (eg. I forget really) then I just make the extra vertexes line up at .025 away from the crosshairs of the grid.

I like your idea, though. It's definarely a great formula...

Thanks, I forgot to add something though. If you are working with a wall, you only need to scale it by 1.41/1.4 lengthwise (on only the axis the object stretches across) If you are working with a block or something more dimensional, you need to scale it on both horizontal axes. (if rotated, z/y) (norm x/z)

CoasterSim.Fan
06-16-2006, 12:56 AM
I have actually been using this formula for a while to figure out my demotions. I also found it useful to use sin cosine and tangent to find some of the angles rotations I need to make my lighting tubs match up they way I want them to.

The_Cook
06-16-2006, 04:27 AM
scale it by 1.41 (1.4 will work)

1.41 is the square root of 2. Given a right angle triangle where the two sides are 1 unit in length then the hypotenuse, from Pythagorus's theorem, is root 2. Because the scaling is a proportionality thing you can do it on a unit triangle rather than having to take the squares of the larger numbers and scale them back at the end.

DarkRidePerson
06-16-2006, 09:16 PM
Hullo, I have another trick for you all (just figured this out)
Its pretty coolio.
Most know that an upward/downward incline (standard) is at a 25 degree angle. However, rotating something in milkshape 25 degrees yeilds pieces that don't match up.

Instead, I found out that it isn't the angle, so much as the ratio. In milkshape a piece that is at a standard upward incline doesn't necessarily have to be exactly 25 degrees, so long as its slope is 1/2 (2/4) It has to rise 2 grid squares for every four squares that it runs (1 for every 2, but in milkshape I think of stuff in fours...)

This ensures that the vertices match up when placed one after another.

Cool huh?

Vodhin
06-16-2006, 11:50 PM
Actually, it seems that the MS grid = the elevations in RCT3- A coaster incline is 4 long, 2 high (Steep is 4l x4 h). I've measured with the rulers here (The large arrows point to one MS grid line):

http://www.vodhin.net/CustomScenery/Vodhin/HowTo/Pic_RulerCoaster.JPG

DarkRidePerson
06-17-2006, 12:47 AM
Actually, it seems that the MS grid = the elevations in RCT3- A coaster incline is 4 long, 2 high (Steep is 4l x4 h). I've measured with the rulers here (The large arrows point to one MS grid line):



well yeah, thats what I meant. 2/4 (rise/run)