Opencascade rational bezercurves
[Email protected]
Abstract.Although polynomials offer extends advantages, there exist a number of important curve and surface types which cannot be represented precisely using polynomials, e.g ., circles, ellipses, hyperbolas, cylinders, cones, spheres, etc. so we introduce the concepts of rational curves and homogeneous coordinates to solve the problem. to understand rational curves in a homogenous coordinate system is more straightforward. if you define irrational bezr curves in 4D space and then project them back into 3D space, you obtain rational curves.
Key Words. Opencascade, rational curves, homogenous coordinate, geom_beziercurve
1. Introduction
Because berstein basis functions are used, the bezr curve has many good properties. However, as a polynomial curve, it is still insufficient to represent some "Basic" curves. For example, the parameter equation of an arc curve with a radius of 1 can be expressed:
The arc curve is not a polynomial curve, so it is impossible to accurately represent a simple curve like an arc. After the parameter transformation T = tan (U/2), the above arc can be expressed:
This shows that rational polynomials can be used to accurately represent the arc curves. In fact, there are many important curves and curved surface types, such as circles, ovans, hyperbolic curves, cylindrical surfaces, cone surfaces, and spherical surfaces, which cannot be accurately expressed by bejiels. According to classical mathematics, all quadratic curves, including circles, can be expressed by rational functions (I .e., Division of two polynomials), that is, rational functions in the following form :,
In this paper, we mainly understand the concept of rational bezr curve from the point of homogeneous coordinate representation and the geometric meaning of the weight factor by combining the bezr curve in opencascade.
2. homogeneous coordinates
Homogeneous coordinates, in this way, we can intuitively understand the significance of rational curves from a geometric perspective. When we first came into contact with the concept of homogeneous coordinates, it was hard to understand. Originally, this was a concept in the projective ry. Readers who are unfamiliar with this concept can refer to Qiu Weisheng's analytic ry, which provides detailed explanations on the concepts of alignment subcoordinates and traffic ratios.
Now we can understand the relationship between the homogeneous coordinate and the affine coordinate. Set M to the normal point on the plane, and (x, y) to the affine coordinate of the standard frame [O1: E1, E2]. For the standard frame [O2: E1, E2, the coordinates of E3] are (X, Y, 1), so the homogeneous coordinates of point M (x1, x2, X3) are proportional to (x, y, 1:
Here, λ =0. Thus:
Therefore, the homogeneous coordinates and affine coordinates of a point can be mutually determined. Sometimes we call the usually point M's affine coordinates (x, y) as its non-homogeneous coordinates.
Center projection transformation from four-dimensional Euclidean space to three-dimensional Euclidean Space
Here, the point of three-dimensional space [x, y, z] is called the perspective image of a four-dimensional space point [x, y, z, ω], that is, a four-dimensional space point [X, Y, Z, ω] The Center projection on the ω = 1 superplane. The center of the projection is the coordinate origin of the four-dimensional space. Therefore, four-dimensional spatial points [x, y, z, ω] and three-dimensional spatial points [x, y, z] are considered to be the same. In fact, for any X, Y, Z, ω 1, ω 2, where ω 1 = ω 2, there are:
It can be seen that the homogeneous coordinates of a point are not unique.
3D space is required for describing the spatial curves and surfaces of a shape in CAGD. However, due to the limitations of human thinking ability, we cannot use graphs or models to express the projection transformation from a four-dimensional space to a three-dimensional space. In order to understand the Geometric relationship of this projection transformation, we can reduce the one-dimensional and investigate the projection transformation from the three-dimensional to the two-dimensional space, as shown in.
Figure 2.1 a representation of Euclidean points to homogeneous form
For more information about the concepts of central projection, projective plane, homogeneous coordinates, and ratio of variation, see the analytic ry book of Qiu Weisheng.
3. begiscurve perspective Map
After understanding the concepts of projection maps and homogeneous coordinates, we can construct a geometric model of a rational beestimated curve. Assuming that the control point {PI} and the weight factor {ω I} are given, we construct the weighted control point:
Then, a non-rational (polynomial) bezr curve is defined in a four-dimensional space:
Write each item in detail by inputting the weighted control point into the above formula:
Take the origin as the center and project the four-dimensional bezr curve to the 3D superplane of ω = 1. The resulting projection curve is:
Eliminate λ to obtain the rational beizer curve:
4. The effects of weighting factors
In addition to the properties similar to those of the bezr curve, the modified properties of the Weight Factor (weights) are also added.
4.1 recoverability
When the Weight Factor ω I = ω =0 (I = 0, 1,..., n), the rational beestimated curve degrades to the beestimated curve. Because ω is the same, the ω in the rational bezr curve formula can be eliminated, and it is obtained according to the standard of the Bernstein basis function. Use the Tcl script of opencascade to test the effect, as shown in:
Figure 4.1 degeneracy of rational besuppliers Curve
The corresponding TCL script is as follows:
## Copyright (c) 2014 eryar All Rights Reserved.## File : degenerate.tcl# Author : [email protected]# Date : 2014-09-19 18:10# Version : 1.0v## Description : Demonstrate the degeneracy of Rational Bezier Curve.#pload ALL# Bezier Curve with Weighted Poles: # {P(1,0), w(1)}, {P(1,1), w(1)}, {P{0,1}, w(1)}2dbeziercurve bc1 3 1 0 1 1 1 1 0 1 1v2d2dfit# Bezier Curve without weights:2dbeziercurve bc2 3 1 0 1 1 0 1mkedge e1 bc2 0 1vdisplay e1vtopvfit
In the above TCL script, the rational bezr curves with the same weight are first displayed in a two-dimensional window, and then the non-weighted bezr curve (the control node is the same as the weighted value) is transformed into an edge, it is displayed in the 3D window. It can be seen from the figure that, when the weight of a rational bezr curve is the same, it degrades to a non-rational bezr curve.
4.2 When ω 0 is 0 and ω N is 0,
You only need to prove the situation of uε [0, 1,
This shows that as long as ω 0 =0, ω n =0, the rational bezr curve R (u) must control the P0 and Pn vertices through the first and last. For u in [0, 1], when ω I is larger, R (u) tends to be pI. On the contrary, when ω I is smaller, R (u) is farther away from Pi.
It can be seen that R (u) passes through PI when ω I → ∞ is the limit state. Use the Tcl script of opencascade to verify the result as shown in:
Figure 4.2 rational bezercurve with different weights
The corresponding TCL script is as follows:
## Copyright (c) 2014 eryar All Rights Reserved.## File : degenerate.tcl# Author : [email protected]# Date : 2014-09-19 18:10# Version : 1.0v## Description : Demonstrate the Rational Bezier Curve with different weights.#pload ALLset w1 0.1set w2 0.5set w3 1.0set w4 2.0set w5 5.0set u 0.5# 4 Bezier Curve with defferent Weighted Poles: # {P(1,0), w(1)}, {P(1,1), w($w)}, {P{0,1}, w(1)}2dbeziercurve bc1 3 1 0 1 1 1 $w1 0 1 12dbeziercurve bc2 3 1 0 1 1 1 $w2 0 1 12dbeziercurve bc3 3 1 0 1 1 1 $w3 0 1 12dbeziercurve bc4 3 1 0 1 1 1 $w4 0 1 12dbeziercurve bc5 3 1 0 1 1 1 $w5 0 1 1# mark weight factor.2dcvalue bc1 $u x1 y12dcvalue bc2 $u x2 y22dcvalue bc3 $u x3 y32dcvalue bc4 $u x4 y42dcvalue bc5 $u x5 y5dtext x1 y1 w1=$w1dtext x2 y2 w2=$w2dtext x3 y3 w3=$w3dtext x4 y4 w4=$w4dtext x5 y5 w5=$w5v2d2dfit
The above code shows the different situations in which a rational bezr curve with three control vertices is used to control the change of the Weight Factor ω corresponding to the P () vertex. When ω increases, the curve is directed to the control vertex. When ω decreases by an hour, the curve is pushed away from the control vertex. When ω tends to be infinite, the curve degrades to a point that overlaps with the control vertex.
5. besuppliers geometry Curve
In opencascade, geom_beziercurve is a rational bezr curve and is implemented based on the bsplclib package. That is to say, the rational beizer curve is also a special case of the curve. As shown in:
When the constructor only controls vertices, a non-rational beizer curve is constructed. When the constructor also sets the weight factor corresponding to the control vertex, a rational trend is constructed. When constructing a rational beizer curve, if the ownership values of the control vertex are the same, it is considered that the curve is a non-rational beizer curve, that is, the embodiment of degradation.
6. Conclusion
To sum up, the concept of rational bezr curves can be understood intuitively by means of homogeneous coordinate notation, and thus the concept of the curve and surface can be understood.
The difference between a rational beizer curve and a non-rational beestimated curve is a weight factor. If all the weights corresponding to the control point are the same, the rational beizer curve degrades to a non-rational bezr curve. The larger the weight factor value, the closer the curve is to the corresponding control vertex. Weights have many important properties for curves. You can refer to other related books.
The beizer curve in opencascade is implemented based on the bsplclib package, which is a special case of the curve. Therefore, it can indicate that there is a rational bezr curve.
7. References
1. Mathematical manual writing group. Mathematical manual. Higher Education Press. 1979
2. Qiu Weisheng. Analytic ry. Peking University Press. 1996
3. Su buqing, Liu Dingyuan. Computational ry. Shanghai Science and Technology Press. 1981
4. Su buqing, Hua xuanji. tutorial on applying ry. Fudan University Press. 2012
5. Mo Rong, Chang Zhiyong. Computer-Aided Geometric Modeling Technology. Science Press. 2009
6. Wang renhong, Li chongjun, Zhu chungang. tutorial on Computational ry. Science Press. 2008
7. Translated by Zhao Yu, Mu guowang, and Wang lanzhu. Non-Uniform Rational B-spline. Tsinghua University Press. 2010
8. Zhu Xinxiong, et al.. Technology of Free Curve and curved surface modeling. Science Press. 2000
9. Sun jiaguang. Computer Graphics. Tsinghua University Press. 2000
10. Sun jiaguang. Computer Aided Geometric Modeling Technology. Tsinghua University Press. 2000
11. Kingdom Jin, Wang guozhao, Zheng Jianmin. Computer Aided Geometric Design. CHEP & Springer-Verlag. 2001
12. Les piegl, Wayne tiler. The Macintosh book. Springer-Verlag. 1997
13. Kelly dempski. Focus on curves and surfaces. Premier press. 2003
14. opencascade. Test harness User's Guide 6.7.1. 2014
15. opencascade. modelingdata User's Guide 6.7.1. 2014
Pdf version and Tcl scripts: opencascade rational bezr Curves
Opencascade rational bezercurves