To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.rayOpen lugnet.cad.ray in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Ray-Tracing / 1553
1552  |  1554
Subject: 
Re: Teardrops
Newsgroups: 
lugnet.cad.ray
Date: 
Thu, 14 Nov 2002 16:59:48 GMT
Viewed: 
1203 times
  
In lugnet.cad.ray, Dave Schuler writes:
In lugnet.cad.ray, Bram Lambrecht writes:
Try creating a lathe object using a quadratic or cubic spline.
http://www.povray.org/documentation/view/48/

I tried messing around with lathe objects, but I was having trouble
approximating the character of the curve.

I gave this a shot... I pretty familiar with bezier curves from using them in
CorelDraw, so I used a bezier_spline.  Basically, for every segment you want,
you create 4 points.  The first and last points are the endpoints of the
segment, and the middle two points are the "control points."  The line that
would connect the endpoint with it's control point becomes the tangent to the
curve, and the length of that line determines the curvature.  For a circle, the
length should be about half of the radius.  Here's what I came up with:

------------------ Begin File ----------------------

  // Teardrop lathe object using bezier curves....

  // Set edit=true to see the control points for the bezier curve
  // Set edit=false to see the final lathe object
  #declare edit=true;

  #include "colors.inc"

  #if(edit)
        camera {
            orthographic
            up <0, 5, 0>
            right <5, 0, 0>
            location <2.5, 2.5, -100>
            look_at <2.5, 2.5, 0>
        }
  #else
        background{White}
        camera {
           angle 10
           location <1, 10, -50>
           look_at <0, 2, 0>
        }
        light_source {
            <20, 20, -20> color White
        }
  #end

  #declare Red_Point    = <0.00, 0.00>;
  #declare Yellow_Point = <0.50, 0.00>;
  #declare Green_Point  = <1.00, 0.50>;
  #declare Blue_Point   = <1.00, 1.00>;
  #declare Yellow_Point2= <1.00, 2.00>;
  #declare Green_Point2 = <0.00, 2.00>;
  #declare Red_Point2  = <0.00, 3.50>;

  #if(edit)
     cylinder { Red_Point, Red_Point - <0,0,20>, .1         pigment { Red    }
finish { ambient 1 } }
     cylinder { Yellow_Point, Yellow_Point - <0,0,20>, .1   pigment { Yellow }
finish { ambient 1 } }
     cylinder { Green_Point, Green_Point - <0,0,20>, .1     pigment { Green  }
finish { ambient 1 } }
     cylinder { Blue_Point, Blue_Point- <0,0,20>, .1        pigment { Blue   }
finish { ambient 1 } }
     cylinder { Red_Point2, Red_Point2 - <0,0,20>, .1       pigment { Red    }
finish { ambient 1 } }
     cylinder { Yellow_Point2, Yellow_Point2 - <0,0,20>, .1 pigment { Yellow }
finish { ambient 1 } }
     cylinder { Green_Point2, Green_Point2 - <0,0,20>, .1   pigment { Green  }
finish { ambient 1 } }
  #end

  lathe {
    bezier_spline
    8,
    Red_Point, Yellow_Point, Green_Point, Blue_Point
    Blue_Point, Yellow_Point2, Green_Point2, Red_Point2
    #if(edit)
        pigment { White }
        finish { ambient 1 }
    #else
        pigment { Blue }
    #end
  }


------------------ End File ----------------------

Hope that helps!
--Bram


Bram Lambrecht
bram@cwru.edu
www.bldesign.org



Message is in Reply To:
  Re: Teardrops
 
(...) approximating the character of the curve. Orion emailed me a pointer to the Glob_5 shape in one of the POV-Ray .inc files, and that was quite a help. I played with the vertex sequence, but my liberal arts brain turns to mush when dealing with (...) (22 years ago, 14-Nov-02, to lugnet.cad.ray)

6 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR