Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
$\pi r^2h$ is the formula for the volume of a cylinder and has nothing to do with the calculation you're after. – jwodder Feb 22 '12 at 1:54
do you know what i need then? – marabutt Feb 22 '12 at 1:56
up vote 1 down vote accepted

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

share|cite|improve this answer
awesome, thanks – marabutt Feb 22 '12 at 2:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.