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?

$\endgroup$
2
  • $\begingroup$ $\pi r^2h$ is the formula for the volume of a cylinder and has nothing to do with the calculation you're after. $\endgroup$
    – jwodder
    Commented Feb 22, 2012 at 1:54
  • $\begingroup$ do you know what i need then? $\endgroup$
    – marabutt
    Commented Feb 22, 2012 at 1:56

1 Answer 1

2
$\begingroup$

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*}$$

$\endgroup$
1
  • $\begingroup$ awesome, thanks $\endgroup$
    – marabutt
    Commented Feb 22, 2012 at 2:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .