SL Taper Primer

26/02/2007

“Taper” is a pretty cool shape-altering feature in SL. If you’re like me and prefer to do all your calculations, sizing, and placement by hand (or if the tool you’re using doesn’t do everything it could), here’s how to deal with all the new dimensions that spring up with using taper.

In this primer, we’ll only deal with Y taper.

plain box

Here we have a box prim with equal dimensions—all 1 m—a cube. We’re using an unrotated cube for simplicity, but these calculations will work for other sized boxes and with X taper as well.

tapered box

Now we’ve applied a Y taper of 0.5 to the box. As you can see, this operation reduces the Y dimension of the top of the box, angles the sides appropriately, and does not alter the X or Z dimensions at all.

tapered box's Y dimension

The magnitude of the Y taper value should reduce the Y dimension of the top of the box as a percentage. In this example, we used a Y taper value of 0.5, which means we reduced the Y dimension by 50%—or, we took off 50% of the Y dimension. Since we took 50% off, that should leave us with 50% left, and as you can see from the previous image, the blue box placed on top is 0.5 m wide (Y dimension) and fits perfectly on top of our tapered box.

That gives us an important value:


y = the original Y dimension of the example box
y[top] = the resultant value of the Y dimension on the top of the tapered example box
∴
y[top] = y ∗ (1 - taper)

Also of note, there is a blue box on the bottom of our example box that is 1 m wide (Y dimension) that shows us that the taper did not affect the size of the bottom of the box.

parallel yellow box

Now I’ve created a yellow (and grey) box exactly as tall as our example box and whose edge fits exactly against the edge of the bottom of our example box. This yellow box creates a right triangle with our example box, and if this will allow us to calculate almost anything we want about how the taper affected the example box.

fuchsia box fills the gap

The fuchsia (or purple) box I just made on top shows us a few things.

First, since the yellow box’s edge fits directly against the bottom of the example box, we know that half of what the taper took away is the length of the fuchsia box (0.25m), which implies that taper took away 0.5 m, which is 50% of the example box’s original Y dimension, as we noted before.

Also, it serves to complete our triangle. We now can see that the fuchsia side of the triangle is 0.25 m in length, the yellow side is 1.0 m in length, and the green side (the hypotenuse) has an unknown width. Also, the angle between the yellow and green sides (we’ll call it Θ) is unknown. These are the values we want to calculate.

First, we can calculate the angle (Θ) between the yellow and green sides. We’ll have to use a bit of trigonometry to do this. Since the tangent of an angle in a right triangle is equal to the length of the opposite side divided by the length of the adjacent side, we at least know this:


tan Θ = length of the purple side / length of the yellow side

or


tan Θ = 0.25 / 1

We can then take the arc tangent (or inverse tangent) of both sides and get this:


Θ = arc tan (0.25 / 1)
Θ ≅ 14.03624346793 degrees

Since we don’t want to do all these calculations every single time, let’s package up all these calculations into a nice, tidy formula. Let’s start with our first viable formula for Θ and go from there.


tan Θ = length of the fuchsia side / length of the yellow side
[y = the Y dimension of the example box]
length of the fuchsia side = half of what taper took away = y ∗ taper / 2
[z = the Z dimension of the example box]
length of the yellow side = z
tan Θ = y ∗ taper / 2 / z
tan Θ = (y ∗ taper) / 2z
∴
Θ = arc tan [(y ∗ taper) / 2z]

Now we might want to figure out the length of the green side. Since we know the lengths of the other two sides of the triangle, the Pythagorean theorem works well here. (Since we now know the value of theta, we could easily use more trigonometry to derive the length of the green side, but I prefer not to work with derived values that we have to round off when possible.)


length of the green side (L) = √[(length of the fuchsia side)² + (length of the yellow side)²]
L = √(0.25² + 1²)
L ≅ 1.0307764064 m

So now I can alter the height of the yellow box, place it such that its bottom edge is the same height as the bottom edge of the example box, use a pivot trick I will explain in a forthcoming article, and voila! (Note that I had to use -14.04 as the Z angle.)

yellow box fits snugly

Let’s package up the calculations for L:


length of the green side (L) = √[(length of the fuchsia side)² + (length of the yellow side)²]
length of the fuchsia side = half of what taper took away = y ∗ taper / 2
length of the yellow side = z
∴
L = √[(y ∗ taper / 2)² + z²]

No comments yet.

Write a comment: