Difference between revisions of "HowTo:Use Splines and Bezier Curves"
Jump to navigation
Jump to search
Line 7: | Line 7: | ||
Splines may be of Linear, Quadratic or Cubic type of Spline and are accessed with the command #spline as shown below. | Splines may be of Linear, Quadratic or Cubic type of Spline and are accessed with the command #spline as shown below. | ||
− | #spline | + | <source lang="pov"> |
+ | #declare MYSPLINE = spline { | ||
+ | cubic_spline | ||
+ | -1, <-1,0,0> | ||
+ | 0, <2,-1,0> | ||
+ | 1, <3,-1,2> | ||
+ | 2, <5,0,5> | ||
+ | 3, <3,3,3> | ||
+ | 4, <2,2,2> | ||
+ | 5, <2,-1,0> | ||
+ | 6, <3,-1,2> | ||
+ | 7, <5,0,5> | ||
+ | } | ||
− | All splines pass through the intermediate | + | #declare count = 0; |
+ | #while (count <= 5) | ||
+ | #sphere { MYSPLINE (count), 0.25 pigment {Blue} } | ||
+ | #declare count = count + 0.01; | ||
+ | #end | ||
+ | </source> | ||
+ | |||
+ | All "spline" type splines pass through the intermediate control points, these are: | ||
+ | #A linear spline will move linearly from one control point to the next. | ||
+ | #A Quadratic Spline will pass from one point to the next with reference only to where it is going. | ||
+ | #A Cubic Spline will pass from one control point to the next with reference to where it cam from and where it will go to next. | ||
+ | |||
+ | The important thing to remember about using splines is that as the control number exceeds a control point, the next increment of control points is taken to control the path of the spline. Sufficient control points need to be defined otherwise POVRay will yield an error or misrepresent the scene. | ||
== Bezier Curves == | == Bezier Curves == | ||
== About Bicubic Patches == | == About Bicubic Patches == |
Revision as of 08:52, 9 December 2007
Introduction
All Curves and Patches utilised by POVRay are influenced by a number of control points. All curves pass through the start and the end control point, while most of the curves pass through the intermediate control points.
Splines
Splines may be of Linear, Quadratic or Cubic type of Spline and are accessed with the command #spline as shown below.
#declare MYSPLINE = spline {
cubic_spline
-1, <-1,0,0>
0, <2,-1,0>
1, <3,-1,2>
2, <5,0,5>
3, <3,3,3>
4, <2,2,2>
5, <2,-1,0>
6, <3,-1,2>
7, <5,0,5>
}
#declare count = 0;
#while (count <= 5)
#sphere { MYSPLINE (count), 0.25 pigment {Blue} }
#declare count = count + 0.01;
#end
All "spline" type splines pass through the intermediate control points, these are:
- A linear spline will move linearly from one control point to the next.
- A Quadratic Spline will pass from one point to the next with reference only to where it is going.
- A Cubic Spline will pass from one control point to the next with reference to where it cam from and where it will go to next.
The important thing to remember about using splines is that as the control number exceeds a control point, the next increment of control points is taken to control the path of the spline. Sufficient control points need to be defined otherwise POVRay will yield an error or misrepresent the scene.