27
Exercise On Wire Frame Modeling Of Various Synthetic Curves Introduction Wireframe modeling systems were popular when geometric modeling was first introduced. Wireframe modeling systems represent a shape of the object by its characteristic lines, curves, and end points. It uses these lines and points to display three dimensional shapes and allow manipulation of the shape by modifying the lines and points. The visual model is simply the wireframe drawing of the shape. The figure shows wireframe model and different views of an object. The mathematical description of wireframe model includes the list of curve equation, coordinates of the points and connectivity information for the shapes curves and points. Wireframe modeling systems require only simple

Exercise on Wire Frame Modeling of Various Synthetic Curves

Embed Size (px)

Citation preview

Page 1: Exercise on Wire Frame Modeling of Various Synthetic Curves

Exercise On Wire Frame Modeling Of Various Synthetic Curves

Introduction

Wireframe modeling systems were popular when geometric modeling was first introduced. Wireframe modeling systems represent a shape of the object by its characteristic lines, curves, and end points. It uses these lines and points to display three dimensional shapes and allow manipulation of the shape by modifying the lines and points. The visual model is simply the wireframe drawing of the shape. The figure shows wireframe model and different views of an object.

The mathematical description of wireframe model includes the list of curve equation, coordinates of the points and connectivity information for the shapes curves and points. Wireframe modeling systems require only simple user input to create a shape and that it is relatively easy for users to develop systems themselves.

Types of curves

The curves used in geometric modeling can be classified as follows.1. Analytic Curves2. Synthetic Curves

Page 2: Exercise on Wire Frame Modeling of Various Synthetic Curves

1. Analytic Curves- This type of curve can be represented by a simple mathematical equation, such as a circle or an ellipse. They have a fixed and cannot be modified to achieve a shape that violates the mathematical equation. The types of analytic curves are1-Line2-Circle3-Ellipse4-Parabola5-Hyperbola

2. Synthetic curves- Synthetic curves are represented by set of data points which defines and controls the trajectory of curves. Parametric curves are not sufficient to fulfill the geometric requirements for the design of object such as impeller casing, car bodies, aircraft wings, turbine blade etc. Synthetic curves are used for such type of object with complex geometric shape.

Synthetic curve passes through defined data points and can be represented by polynomial equation. Synthetic curves can be generated by two ways1. Interpolation2. Approximation

Mathematical representation of various curves

Curve is defined as the locus of a point moving with one degree of freedom. A curve can be represented by its analytical equation or its coordinate array. Mathematically curves can be represented in two forms;1. Non-parametric Representation2. Parametric Representation

Non-parametric Representation:-

Non-parametric representation is also known as generic representation

Page 3: Exercise on Wire Frame Modeling of Various Synthetic Curves

In non-parametric representation, the object is described by its coordinates with respect to the current reference frame.

The curve is represented by the relationship between the coordinates x, y and z which satisfy the function f(x, y, z) = 0.

Non-parametric representation can be further classified in two forms:1. Explicit form2. Implicit form

1. Explicit formIn explicit non-parametric representation of curve, any two coordinates(y and z) of a point are expressed as two separate functions of the third coordinates(x) as the variable.

If a point P(x, y) is to be represented by position vector P as shown in fig then P=[x y] P=[x f(x)] Where, y=f(x) = function of x

Example:1. For line y=m x + c, the position vector of any point can be represented by

P = [ x y ] = [ x f(x) ] = [x m x +c]

2. For circle having radius r and center at origin the explicit representation can be:

P= [ x y ] = [ x f(x) ]= [ ]

The explicit representation of a three dimensional curve can be as below,

P = [ x y z ] =[ x f(x) g(x)]

Where, f(x) and g(x) are the functions of x

The explicit representation is not useful in geometric modeling because it is unusable for closed curves having more than one dependent variable.

2. Implicit formThe implicit non parametric form represents the curve as locus of point that satisfy an equation. The implicit representation in two dimension is of the form: F(x, y) = 0

Page 4: Exercise on Wire Frame Modeling of Various Synthetic Curves

Where f(x, y) is the function of both x and y coordinates

Example:1. For line, the implicit form of representation is:

ax + by + c = 0

2. The curves of second degree(conics) can be represented as the loci of point which satisfy the general equation:

=0

The implicit representation of a three dimensional curve can be as below:

P = [ x y z] = [ x f(x) g(x) ] Where, f(x) and g(x) are the functions of x

Disadvantages of Non-parametric Representation:

Non-parametric representation is not suitable for closed and multivalued curves.

In case of non parametric representation, the solution of simultaneous equation is lengthy process.

When the tangent of curve is vertical the slope of tangent is infinite. Such conditions cannot be handled by non-parametric representation.

The curve equations in non-parametric representation are coordinates system dependent which is not preferable for geometric modeling because most engineering curves are independent of coordinate system.

Parametric Representation

The parametric representation of curve is done by set of equations made up of a common independent variable known as parametric variable. The coordinates x, y and z of any point on curve are expressed as a function of a independent variable ‘u’ which acts as local variable. A point P(x, y, z) on curve may be represented by

P = [ x y z ]

P(u) = [ x(u) y(u) z(u) ]

Where

X, y, z are coordinates of the curve points.

Page 5: Exercise on Wire Frame Modeling of Various Synthetic Curves

u is parametric variable which is constrained in definite interval [ , ]. Where are initial and final values of parameter u.

Fig represents the parametric representation of a curve in cartesian space and curve components in parametric space.

The slope of tangent vector at any point on curve in parametric space can be defined as:

The magnitude and direction of the slope at any point on curve is given by:

| |= and

= =

Example

Page 6: Exercise on Wire Frame Modeling of Various Synthetic Curves

The point p( x y ) lying on circle having center at origin can be represented parametrically by :

P = [ x y ]

=

=

Page 7: Exercise on Wire Frame Modeling of Various Synthetic Curves

Where, r is radius of circle and is parametric variable which is angle between radius vector of point and X-axis. For circle the range of is 0 360.

Advantages of Parametric representation-

1. Separation of variable allows each variable to be treated separately.

2. The transformation of parametric equations can be done easily.

3. Infinite slops of tangents can be handled without computational breakdown.

4. Vector representation is easy.

5. Closed and multi-valued curves can be represented easily.

Wire frame models and entity representation

All the existing CAD/CAM systems provide users with basic wire-frame entities. Most of the wire-frame models consists of points, lines and arcs, which are the basic entities of model. The entities can be divided into analytical entities and synthetic entities. Analytical entities include points, lines, arcs and circles, fillets and chamfers and conics such as ellipse, parabola and hyperbola. Various types of splines such as cubic spline, β-spline, β and γ-splines and Bezier curves are synthetic entities. Entities are building blocks of geometric models hence mathematical treatment of entities would provide insight into CAD/CAM. Mathematical representation of these entities are given as follows…

(1) Absolute coordinate system point by its coordinates P (x, y, z).

(2) Point by its polar co-ordinates

(2) Point as an centre point of an existing entity

Page 8: Exercise on Wire Frame Modeling of Various Synthetic Curves

Defining lines

Defining arcs and circles

Page 9: Exercise on Wire Frame Modeling of Various Synthetic Curves

Define synthetic entities

Parametric representation of various curves

1. Line

Page 10: Exercise on Wire Frame Modeling of Various Synthetic Curves

The simplest fixed-form curve is a straight line. Parametric equation of a straight line is given as,

P(t) = A + (B-A) t

The parametric equation of line AB can be derived as,

x = x1 + (x2 - x1) t

y = y1 + (y2 - y1) t

. where, 0 ≤ t ≤ 1

The point P on the line is sweeped from A to B, as the value of t is varied from 0 to 1.

Example - Parametric Representation of a Straight Line For the position vectors P1 [1 2] and P2 [4 3], determine the parametric

representation of the line segment between them. Also determine the slope and tangent vector of the line segment.

Solution

A parametric representation is

P (t) = P1 + (P2 – P1) t = [1 2] + ([4 3] – [1 2]) t 0 < t < 1

P (t) = [1 2] + [3 1] t 0 < t < 1

Parametric representations of the x and y components are x (t) = x1 + (x2 – x1) t = 1 + 3t 0 < t < 1

y (t) = y1 + (y2 – y1) = 2 + t

The tangent vector is obtained by differentiating P (t). Specifically,

P' (t) = [x' (t) y' (t)] = [3 1]

Or Vt = 3i+j where, Vt is the tangent vector and i, j are unit vectors in the x, y directions, respectively. The slope of the line segment is

Page 11: Exercise on Wire Frame Modeling of Various Synthetic Curves

2.Circle

The non-parametric equation of a circle is,

(x – xc)2 + (y – yc)2 = r2 (4.2)

Where, xc, and yc are coordinates of the center, and r is radius of the

circle.

If we were to use this form of the equation for plotting a circle or a circular curve, we will first calculate several values of x and y along the circumference of the circle, and then plot them. The curve thus generated will be of a poor quality, unless we plot a very large number of data points, which will result in a significant demand for storage of these data points. Therefore, as stated earlier, in CAD programs, we use a parametric equation, which avoids the need for storage of the data points, and provides a smooth curve. The parametric equation of the above circle can be written as,

xi = xc + r cosθ

yi = yc + r sinθ

This equation is converted into a matrix form so that a computer can solve it. We will now convert this equation into a matrix form.

Let us assume that the plot starts at the point (xi, yi), and the center lies

at the origin. We increment θ to (θ +Δθ), giving us the new point on the circle (xi+1, yi+1),

or

xi+1 = r cos(θ +Δθ)

yi+1 = r sin(θ +Δθ)

Page 12: Exercise on Wire Frame Modeling of Various Synthetic Curves

Expanding it by the use of trigonometric identities, we get:

xi+1 = r cosθ cosΔθ - r sinθ sinΔθ

yi+1 = r sinθ cosΔθ + r cosθ sinΔθ

Substituting the values: xi = r cosθ, and yi = r sinθ, we get

xi+1 = xi cosΔθ - yi sinΔθ

yi+1 = yi cosΔθ + xi sinΔθ

In matrix form, these equations can be written as,

[xi+1 yi+1 0 1 ] = [xi yi 0 1] (A)

Equation (A) is valid for a circle that has center at the origin. To find the equation of a circle that has center located at an arbitrary point (xc, yc), we can use the translation transformation. Note that the equation (4.4) can be interpreted as rotational transformation of points xi and yi about the origin.

Now, instead of rotation about the origin, we wish to rotate the point about the fixed point (xc, yc). This can be accomplished by the three-step approach, discussed in chapter 2, i.e., first translate the fixed point to the origin, rotate the object, and finally translate it so that the fixed point is restored to its original position. Using this procedure we will get:

[xi+1 yi+1 0 1] =

Page 13: Exercise on Wire Frame Modeling of Various Synthetic Curves

[xi yi 0 1] *

(B)

Simplifying the equation we get,

xi+1 = xc + (xi – xc) cosΔθ - (yi – yc) sinΔθ

yi+1 = yc + (xi – xc) sinΔθ + (yi – yc) cosΔθ

Even though, equations (B)can be used as an iterative formula to plot a circle or a circular curve, using the EXCEL or MATLAB, or any other plot routines, the matrix equation (A) is the preferred form for a CAD program. The original CAD programs used iterative formulas to generate curves. The BASIC and FORTRAN languages were used to write the CAD codes.

3.Ellipse

Following the procedure outlined in the previous section, we can derive the parametric equations of an ellipse. Parametric equation of an ellipse is given by the equation

xi = a cosθ

yi = b sinθ

For a point on the ellipse, in general, the equation is

Page 14: Exercise on Wire Frame Modeling of Various Synthetic Curves

xi+1 = xi cosΔθ – (a/b) yi sinΔθ 2a

yi+1 = yi cosΔθ – (b/a) xi sinΔθ

For a more general case, when the axes of the ellipse are not parallel to the coordinate axes, and the center of the ellipse is at a distance xc, yc from the origin, the equation of the ellipse is given below. Let α be the angle that the major axis makes with the horizontal (x-axis), as shown. The equation of the ellipse can be derived as

xi = xc + x’i cosα – y’i sinα

yi = yc + x’i sinα + y’i cosα

Where, x’ and y’ are the coordinate values of a Point on the ellipse, in term of the rotated axes x’ and y’.

Equations can be used to write either as an iterative formula or as a matrix equation for creating an elliptical curve.

4.Parabola

Review of vector algebra-

The basics of vector algebra are required in order to represent the curves in parametric form. For geometric modeling of any object the matrices consisted of various points are required to be handled in vector form.

Page 15: Exercise on Wire Frame Modeling of Various Synthetic Curves

ScalarA scalar is a quantity that can be represented by a single real number. Scalar has only magnitude and has no direction. The example of scalar quantities are mass, speed, time, electric charge energy etc.

Representation of vectorVector is an order set of numbers from which we can derive properties of magnitude and direction. Vector can be denoted by writing the symbol of that property with bold letters.

Parametric representation of synthetic curves

Hermite cubic spline curve

The main idea of the Hermite cubic spline is that a curve is divided into segments. Each segment is approximated by an expression, namely a parametric cubic function. The reasons for using cubic functions to approximate the segments are

cubic polynomial is the minimum-order polynomial function that generates C0, C1 and C2

continuity curves.

A cubic polynomial is the lowest-degree polynomial that permits inflection within a curve segment and allows representation of non-planar (twisted) space curves.

Higher-order polynomials have some drawbacks, such as oscillation about control points, and are uneconomical in terms of storing information and computation.

The general form of a cubic function can be written as

where the point v

Page 16: Exercise on Wire Frame Modeling of Various Synthetic Curves

where the point vector r of the cubic curve is defined by the parametric equation V (t). The

segment defined by the equation has highest-degree polynomial t3. The parameter t is traditionally bounded by the parameter interval 0 < t < 1.

The general form represents the whole family of cubic curves. We can define any particular curve by specifying the four coefficient vectors (that is, a0, a1, a2, a3). However, the

coefficients do not all have direct physical significance and are not convenient “handles” for adjusting the segment shape or incorporating it into a composite curve.

The Hermite cubic spline presents a way to define the coefficients more meaningfully. That is, we want to define a curve by V (0) and V (1), V ′ (0) and V ′ (1), where V (0) and V (1) are the position vectors at the ends of the segment and V ′ (0) and V ′ (1) are the tangent vectors at the endpoints. The geometric meaning is that the two endpoints of the Hermite cubic curve are at V (0) and V (1) and the two tangent vectors at the two endpoints are V ′ (0) and V ′ (1). This gives users a way to connect two curves and assure a certain degree of continuity. An example of a Hermite cubic spline is shown in Figure . We next derive the parameter equation, given that V (0), V (1), V ′ (0) and V ′ (1) are known.

A

Upon differentiation of above Equation of V (t), we have

Applying the boundary conditions to the above Equations

At t = 0; V (0) = a0, V ′ (0) = a1

At t = 1; V (1) = a0 + a1 + a2 + a3 V ′ (1) = a1 + 2a2 + 3a3

On solving these four equations simultaneously for the coefficients, we get

a0 = V (0)

a1 = V ′ (0)

a2 = 3 [V (1) – V (0)] – 2V ′ (0) – V ′ (1)

a3 = 2 [V (0) – V (1)] + V ′ (0) + V ′ (1)

Substituting these coefficients into above equation of V (t) and rearranging gives

Page 17: Exercise on Wire Frame Modeling of Various Synthetic Curves

The equation can be represented in matrix form as

r=T.M.P. = [1 t ]

t = [1 t ]

M= , P=

This form can be conveniently adjusted to yield various shapes of curve segment by altering one or more of V (0), V (1), V ′(0) and V ′(1) appropriately. The Hermite form of a cubic spline is determined by defining positions and tangent vectors at the data points. Hermite cubic curves are also called as Ferguson’s cubic curves. The equation of V (t) is a power basis representation and is good for computation.

There are some disadvantages of this method which are given below,

-First-order derivatives are needed; it is not convenient for a designer to provide first-order derivatives.

-There is not local control support.

- The order of the curve is constant regardless of the number of data points.

- Physically, the values of parameters a0, a1, a2 and a3 do not have any intentive meaning. If

you know these values, you can’t guess the shape of the curve.

B-spline curve

Imagine that you need to represent a very complex, curved shape approximated by, say, 20 points. If we design this shape using a Bezier, we will need a degree 19 curve. Such curves are difficult to maintain/modify and compute. We would prefer to work with lower degree functions for computational reasons. Further, depicting a curve by a single high degree

Page 18: Exercise on Wire Frame Modeling of Various Synthetic Curves

function is not good when we modify shapes – since each control point has some effect on the shape of the curve. Thus, changing the location of P18 will change the shape (a little)

near the control point P2. But often, in design, we would like more “localized” control on

shape modification. We now study a method to solve both of the above problems.

The solution to the problem is the following: divide the entire shape into smaller segments, and represent each segment with a low order polynomial. The math’s of this simple idea is not too simple, but we shall look at the basics at least. The figure below shows this idea, where the curve C (u) is made up of 3 segments, defined as Ci (u), i = 1, 2, 3, the domain of

Ci is over ui – 1 î X_î_Xi, and u0 = 0 < u1 < u2 < u3. Now we can use any of the conventional

(e.g. power basis, or Ferguson, Bezier etc.) mechanisms to describe each curve segment Ci,

but to be useful, we must ensure that at the intermediate vertices, called the breakpoints, the curves maintain some level of continuity

There are many ways to implement the above idea. We shall look at B-Splines, which are a general form of Bezier. B-splines provide functions of the form –

where Pi are the control points, and the {fi (u), i = 0, . . . , n} are piecewise polynomial

functions that form a basis for the vector space of all piecewise polynomial functions of some given degree and continuity at a given set of breakpoints {ui, i = 1, . . . , m}. Note that

continuity (at least with respect to the parameter u) is dictated purely by the basis functions fi (u) – the control points can be modified without affecting the continuity. Further, we would like C (u) to possess the convex hull property, as well as the coordinate frame invariance property. Another property we wish our fi (u)’s to have is that of local support – each fi (u) is

non-zero in only a (given) small number of intervals, but not over the entire domain [u0, um].

Since Pi is multiplied by fi (u), moving Pi will only affect the curve shape in the range where

fi (u) is non-zero.

All these, and other beautiful properties are possessed by B-splines. To understand B-splines, we need to first study the B-spline basis functions. Let U = {u0, . . ., um} be a non-decreasing

sequence of real numbers, that is, u0 î_ X1 î_ X2 … î_ Xm. The ui are called knot points, or

simply knots, and U is the knot vector.

Properties of the B-spline Functions

Page 19: Exercise on Wire Frame Modeling of Various Synthetic Curves

-Local Support Property : Ni, p (u) = 0 for u outside the interval [ui, ui + p+1). This property

can be deduced from the observation above that Ni, p (u) is a linear combination of Ni, p–1 (u) and Ni + 1, p–1 (u).

- In any given knot span, at most p + 1 of the basis functions are non-zero. Which basis functions can be non-zero in the knot span [uj, uj+1)?

-Non-negativity : Ni, p (u) for all i, p and u. This is proved easily using induction on p. ˆi

- Partition of Unity : For any knot span, [ui, ui+1), sum of Nj, p (u) = 1.

-Continuity : All derivatives of Ni, p (u) exist in the interior of any knot span (since it is a

polynomial).

-At a knot, Ni, p (u) is (p – k) times differentiable, where k is the multiplicity of the knot (that

is, the number of knots of the same value is the multiplicity of the knot at that value).

Bezier curve

Bezier curves are used in CAD and are named after a mathematician working in the automotive industry. Bezier curves are based on approximation techniques that produce curves that do not pass through all the given data points except the first and the last control point. A Bezier curve does not require first-order derivative; the shape of the curve is controlled by control points.

As in the previous section, we consider one segment of the curve. For n + 1 control points, the Bezier curve is defined by a polynomial of degree n as follows

where V (t) is the position vector of a point on the curve segment and Bi, n are the Bernstein polynomials, which serve as the blending or basis function for the Bezier curve. The Bernstein polynomial is defined as

where C (n, i) is the binomial coefficient given by

Page 20: Exercise on Wire Frame Modeling of Various Synthetic Curves

Here V0, V1, . . . , Vn are the position vectors of n + 1 points that form the so-called

characteristic polygon of the curve segment.

The Bezier curve has the following properties :

- Since Bezier curves are polynomial functions, they are easily computed, and infinitely differentiable (so tangents and curvatures are easily computed).

- The curve begins at the first control point, P0, and ends at the last control point, Pn. It does

not pass through any of the intermediate control points.

-The tangent at the start point (u = 0) lies along the vector from P0 to P1; the tangent at the

end point (u = 1) lies along the vector from Pn –1 to Pn.

-The entire curve lies in the interior of the convex hull of the control points. This is called the convex hull property, and is extremely useful for many CAD/CAM routines.

-Bezier curves are invariant over affine transformations of the control points. In other words, if the control points are translated, or rotated, the curve moves to the corresponding new coordinate frame without changing its shape.

Page 21: Exercise on Wire Frame Modeling of Various Synthetic Curves
Page 22: Exercise on Wire Frame Modeling of Various Synthetic Curves