0
$\begingroup$

I am trying to build a basic color approximation model for a website. I think the HSL would be the most efficient model to use. I remember from school the formulae for a cylinder is $\pi r^2 h$

height = L, S = radius and I am given an angle for H. Given an HSL value, how do I convert it to X, Y, Z coordinates?

  • 0
    do you know what i need then?2012-02-22

1 Answers 1

1

Assuming that the height $L$ is the height above the $xy$-plane, $z$ obviously equals $L$.

By basic trigonometry, a point in the $xy$-plane a distance $r$ from the origin and at an angle of $\theta$ from the $x$-axis is located at $(r\cos\theta, r\sin\theta)$, and this formula is preserved when the plane is translated upward/downward.

Thus (using $H$ to represent the angle itself):

$\begin{eqnarray*} x & = & S\cos H \\ y & = & S\sin H \\ z & = & L \end{eqnarray*}$

  • 0
    awesome, thanks2012-02-22