Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Graphing an oblique circular cone.

  1. Aug 19, 2012 #1
    I have recently experimented with algorithms for rendering colour gradients. Linear gradients are no problem, but radial gradients have proved to be somewhat more difficult. A radial gradient focused at the centre is simply a matter of measuring the distance of a pixel from the centre and comparing it to the radius of the gradient. I found that the most elegant solution was to represent the gradient as an inverted cone of height 1.0. This way, with a single equation I can discover the ratio with which to interpolate colours. I used the following quadric surface equation:

    [itex]\frac{x^{2}}{a^{2}} + \frac{y^{2}}{b^{2}} - \frac{z^{2}}{c^{2}} = 0[/itex]

    Solving for z, I get the ratio.

    The problem is that this works only for right circular or elliptical cones. If the apex is not above the centre, as with an oblique cone, this equation will not help me. I need this because a radial gradient's focus need not be at its centre. I can discover the ratio via a line-circle intersection, but I feel that representing the gradient as an oblique cone would be more elegant and probably more efficient. Unfortunately, I cannot find any information on how one might graph such a cone and my math education is limited to introductory single-variable calculus -- and that was over a decade ago. As such, deriving the correct equation myself is beyond me.

    Can anyone help me find such an equation, assuming one exists?

    I have attached an example of the kind of radial gradient I would like to reproduce.

    Attached Files:

  2. jcsd
  3. Aug 21, 2012 #2
    I've come to the conclusion that an oblique circular cone is merely a right elliptical cone. The bottom of the oblique cone is a conic section that is inclined such that the ellipse is now a circle. Unfortunately, this doesn't help me much, as I'm sure that rotating a quadric surface involves some very complex math.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook