- Home
- User Articles
- How to Create Surfaces of Revolution via User Defined Objects
- Home
- Programming ZEMAX
- User Defined Features
- How to Create Surfaces of Revolution via User Defined Objects
How to Create Surfaces of Revolution via User Defined Objects
- By Anatoli Trafimuk
- Published 7 August 2008
- User Articles , User Defined Features
-
Rating:




Bezier curve and parametric surfaces
Some surfaces can’t be represented in implicit form, but they can be parametric where each surface point satisfies the equations [3]: xS = f(u,v), yS = g(u,v), zS = h(u,v), where (u,v) - parameters of surface. The normal vector to surface at point xS0 = f(u0,v0), yS0 = g(u0,v0), zS0 = h(u0,v0) is defined by the crossproduct:![]()
Ray equations are xR = x1 + lt, yR = y1 + mt, zR = z1 + nt. Here, (x,y,z) are ray coordinates at flat triangular facet, (l,m,n) are ray direction cosines. At ray-surface intersection point, we must have xR = xS, yR = yS, zR = zS. So we obtained system of equations Fx = f(u,v) - (x + lt) = 0, Fy = g(u,v) - (y + mt) = 0, Fz = h(u,v) - (z + nt) = 0 and three unknown parameters (t,u,v). If solved, distance to actual surface and normal vector is obtained.
As an example, let’s choose a surface of revolution of Bezier curve as a side surface; front and rear are still flat. A Bezier curve is parametric and defined by the following equations [4]: ![]()
where:![]()
Here, Pi = (Xi,Yi) are control points of Bezier curve and the total number of points is n+1. With a two dimensional curve, B(t) = (Bx(t),Bz(t)). For revolution of a curve, the parameter v must be included, so the surface of revolution is xS = By(u) sin(v), yS = By(u) cos(v), zS = Bx(u). Note that these three equations are correct for other curves. The surfaces of revolution of Bezier and native curves are shown below.
To solve the above system of equations, the Newton method described in [5] is used: F(X) = (Fx(X),Fy(X),Fz(X)) = 0, where X = (u,v,t). Then next iteration root is Xk+1 = Xk - J(Xk)-1F(Xk), where -1 power denotes inverse matrix and J denotes Jacobian of F:
When ||Xk - Xk+1|| < e, where e is a user-defined small number, the system is solved. With a periodic function, the result can be incorrect and the choice of starting point for the Newton method is very important.