Opencascade Curve Length Calculation

Source: Internet
Author: User

Opencascade Curve Length Calculation

[Email protected]

Abstract.The natural parametric equations of a curve are parametric equations that represent the curve in terms of a coordinate-independent parameter, generally arc length S, instead of an arbitray variable like T or U. according to the natural equations, the curve length is the integration of the curve parametric equation's derivation. so the Core Algorithm for curve length calculation is the numerical integration method. opencascade use Gauss-legendh to calculate the integration for single variable and multiple variables. because of curve in opencascade is single variable function, so can use the Gauss-legendh to calculate the arc length for the curve.

Key words.Opencascade, the Gauss-legendh integration, parametric curve,

The natural parametric equations, arc length,

1. Introduction

For the same curve, the expressions of the selected parameters are also different. The arc length of the curve itself is the constant of the curve itself. It has nothing to do with the choice of the coordinate system. Therefore, it is very important to take the arc length of the curve as a parameter to study the curve. The arc length of a curve is used as the parameter of the curve equation. Such an equation is called the natural parameter equation of the curve. According to the natural parameter equation of the curve, the arc length of the curve is the integral of the derivative of the curve parameter equation. Therefore, the core algorithm used to calculate the arc length of a curve becomes the integral of the calculation function.

In opencascade, tkmath provides a high-precision integral calculation algorithm, the Gauss-legende integral method, which can be used to calculate single-variable and multi-variable functions. Because the curve in opencascade is a single-variable parameter equation, you can use Gauss-legendh to calculate the integral and then obtain the arc length of the curve. As shown in:

Figure 1.1 length of Curve

This article describes the concept of natural parameter equations of curves, and briefly introduces the Gauss-legendh Algorithm and Its Application in opencascade, that is, the arc length of the curve.

2. The natural parametric equations

If different parameters are selected for the same curve, their expressions are also different. Therefore, when we use a coordinate system to discuss the curve, the curve has a human nature, and the arc length of the curve itself is the curve's invariant, it is irrelevant to the selection of coordinate systems. Therefore, we take the arc length of the curve as a parameter to study the inherent properties of the curve. Whether it is theoretical exploration or practical research, ARC-length parameterization is of great significance.

For a given spatial curve R, take P0 (x0, y0, z0) as the starting point for calculating the arc length. The arc-length integral formula is used to calculate the arc-length between P (x, y, z) and P0. As a result, the point position on the curve corresponds to the arc length at the point, as shown in:

Figure 2.1 arc length parameterization

That is, the coordinate of the point on the curve is a function with the arc length as the parameter:

According to its vector equation, the curve is the vector function with the arc length as the parameter. We call it the arc length parameterization ). The arc length is called the natural parameter and the curve equation is called the natural parameter equation ). The relationship between natural parameter equations of curves and parameter equations is discussed: the vector equations of known curves are:

Then the differential and integral formulas of the arc length are:

S (u) is the arc length between P0 and P corresponding to the U0 and U1 parameters. Arc-length parameterization is an important concept. However, if the formula used to calculate the arc length is cumbersome, you can use the accumulated String Length Method for approximate calculation.

Given curve:

The following formula is used to calculate the string length:

Figure 2.2 parametric curve

The more the parameter axis equals, the more accurate the arc length of the obtained curve.

3. the Gauss-legendh Integration

The method for calculating the accumulated string length is the Newton-Cotes integral calculation method. Newton-Cotes equals the integral interval and takes the shard point as the Product node. It is easy to see that when the integral range is large, it is difficult to guarantee the accuracy of the approximate values obtained by using the Newton-Cotes formula.

There are many numerical algorithms for integration. The gauss-legendh product formula has the advantages of low computing workload and high accuracy of the obtained approximate values. It is a high-precision product formula. The formula is as follows:

If the algebraic accuracy reaches 2n + 1, it is called the Gaussian product formula and the corresponding Product node x0, X1,... XN is the Gauss point ). AK is the product coefficient.

The mathematical library of the core modules of opencascade tkmath contains the Gauss-legensid product algorithm, which can be used to calculate the credits of Single-variable and multi-variable functions. The corresponding classes are math_gausssingleintegration and math_gaussmultipleintegration. The Gaussian points and coefficients required for calculation are obtained through the Table query. The data is listed in the math. cxx file in the form of an array, as shown in:

Figure 3.1 Gauss point for Gauss-legendh Integration

One of the functions of Gauss-legendh integration is to calculate the arc length of the Curve Based on the natural parameter equation of the curve. The code implementation is as follows:

//=====================================================================//function : Length//purpose  : 3d with parameters//=====================================================================Standard_Real CPnts_AbscissaPoint::Length(const Adaptor3d_Curve& C,                      const Standard_Real U1,                      const Standard_Real U2) {  CPnts_MyGaussFunction FG;//POP pout WNT  CPnts_RealFunction rf = f3d;  FG.Init(rf,(Standard_Address)&C);//  FG.Init(f3d,(Standard_Address)&C);  math_GaussSingleIntegration TheLength(FG, U1, U2, order(C));  if (!TheLength.IsDone()) {    Standard_ConstructionError::Raise();  }  return Abs(TheLength.Value());}

According to the Code for calculating the arc length of a curve, you can calculate the arc length of the curve within the curve by specifying the curve and its product range. Because the product calculation is used directly, the arc length value of the obtained curve is very accurate.

Gaussian product formula is a product formula with high precision. When the number of product nodes is the same, that is, when the computing workload is similar, the Gaussian product formula can obtain the approximate values of points with higher accuracy procedures. However, it must calculate the value of the product function on an unequal node, and when the number of nodes changes, the data used must be computed again in the table.

4. Conclusion

The arc length of the curve itself is the constant of the curve itself. It has nothing to do with the choice of the coordinate system. Therefore, it is very important to take the arc length of the curve as a parameter to study the curve. The arc length of a curve is used as the parameter of the curve equation. Such an equation is called the natural parameter equation of the curve. According to the natural parameter equation of the curve, the arc length of the curve is the integral of the derivative of the curve parameter equation. Therefore, the core algorithm used to calculate the arc length of a curve becomes the integral of the calculation function.

In the textbooks such as calculation method and numerical analysis, there are algorithms for integral calculation. In opencascade, the Gauss-legendh product algorithm is implemented. The gauss-legendh product calculation algorithm is a high-precision product calculation method. Therefore, according to the natural parameter equation of the curve, the arc length of the curve is the integral of the derivative of the curve parameter equation. Therefore, the arc length of the curve can be obtained accurately using the Gaussian product method.

If you are interested in the specific algorithm of numerical points, you can refer to related books such as calculation method, numerical analysis, and numerical calculation.

5. References

1. Zhu Xinxiong. Technology of Free Curve and curved surface modeling. Science Press. 2008

2. Wang renhong, Li chongjun, Zhu chungang. tutorial on Computational ry. Science Press. 2008

3. Yi dayI, Shen yunbao, Li youfa. calculation method. Zhejiang University Press. 2002

4. Yi dayI, Chen daoqi. Introduction to numerical analysis. Zhejiang University Press. 1998

5. http://mathworld.wolfram.com/NaturalParametricEquations.html

6. http://mathworld.wolfram.com/Legendre-GaussQuadrature.html

7. http://en.wikipedia.org/wiki/Gaussian_quadrature

Http://pomax.github.io/bezierinfo/legendre-gauss.html

 

Pdf version: opencascade Curve Length Calculation

Opencascade Curve Length Calculation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.