Opencascade Pcurve of topological face
[Email protected]
Abstract. Opencascade provides a class brepbuilderapi_makeface to build topological faces. A face maybe built from a surface, elementary surface from GP, surface from Geom, from a wire and find the surface automatically if possible, etc. If a face was built, how to check it for visualization? What does Pcurve means? The paper would answer those question.
Key Words. Opencascade, topological face, Pcurve, Holes
1. Introduction
The brep surface of the opencascade boundary representation topological face contains the complete geometry information, given a topods_face, which contains edges and vertices, while edges and vertices contain geometric curves and three-dimensional points. Visualization of edges and vertices is well understood: displaying vertices is a three-dimensional point in the scene; the simplest algorithm for displaying edges is to sample the curves in the parameter space, and then connect the parameters to the points on the curve to simply display the edges, and how can the polygons be visualized?
In the geometric modeling kernel, there is a concept of parametric curve, namely Pcurve (parametric Curve), which is a very important data to realize surface visualization. Pcurve is defined as a two-dimensional spline in the two-dimensional (U, v) parametric space of a curve on a surface represented by a parameter, that is, a curve on a surface (Curve on surface).
It is better to do further research on the basis of understanding the definition of pcurve, and to answer the question "Where to go from," that is, how to produce pcurve, how to use the generated pcurve data. This paper mainly introduces how to visualize the Pcurve in the Opencascade topology so as to facilitate the inspection of the topology surface, and to see the application of Pcurve in the visualization of the curvature. The production of pcurve and other applications need to be further excavated. If you have any comments on pcurve, please feel free to enlighten me.
2.Pcurve of a face
The algorithm for visualizing the topology shape in the Opencascade [2] shows that the opposite meshing needs to be separated from the central ring, the edges in the ring are discretized, and finally all the parameters are unified, that is, a two-dimensional meshing algorithm is needed to mesh the two-dimensional parametric space. Finally, the points of the parametric space mesh are mapped back to the geometric surfaces in the polygon, which is the spatial meshing of the surface.
Figure 2.1 Mesh UV domain of a Surface
As shown in 2.1, the boundary line in the UV parameter space is the Pcurve of the edge of the ring in the topological surface, that is, the ring in the topology corresponds to the boundary in the parameter space, and the representation of these boundaries is the use of pcurve. The most common algorithm for meshing parametric space is the Delaunay triangulation algorithm [3], which used an open source Delaunay library triangle[4] In earlier versions of Opencascade. The surface is visualized by mapping the results of the surface in the parametric space back to the three-dimensional space of the surface. How to control the surface discrete precision still needs further study.
Figure 2.2 A Smiley face meshed by Triangle
2.2 Shows the result of splitting a smiley face with a two-dimensional triangulation library triangle.
In the draw Test Harness, Opencascade provides a command pcurve opposite the Pcurve visualization. Use the Pcurve command to display all the pcurve in a polygon in different colors depending on the direction orientation. This command is useful for checking the correctness of the orientation of the edges in the polygon. The following uses the TCL command to display the pcurve of the base surface in the draw Test harness.
2.1 Plane Pcurve
The parametric equation of the plane in the Opencascade is:
The plane equation represented by the above parameters shows that the definition field of the plane is infinite, so in order to generate a ring topology, it is necessary to set the boundary of the plane to crop the infinite plane. The corresponding TCL script is as follows:
#1. View the pcurves of a plane faceplane P#Trim the plane to (u,v)->[-1, 1][-1, 1]Trim P P-1 1-1 1#Make the topo faceMkface p p#Extract the 2d curve of an edge in a facePcurve P#display Pcurve in 2d viewerAv2dfit2dfit#display face in 3d viewerVdisplay P
The build results are as follows:
Figure 2.3 Color for Pcurves
As shown in Figure 2.3, there are four colors of Pcurve:
V Rouge:forward Carmine indicates positive direction;
V bleu:reversed Blue denotes reverse; (I don't know if it's French or a typo, blue English should be)
V rose:external Rose red indicates outward;
V orange:internal Orange yellow indicates inward;
According to the color rules above, figure 2.4 shows that the pcurves of the plane boundary is closed counterclockwise.
Figure 2.4 Plane Pcurves
Figure 2.5 Plane face in 3D Viewer
2.2 Cylinder Pcurve
The parametric equation of the cylindrical surface in the Opencascade is:
The parameter equation shows that the value range of U is bounded [2, 2pi] and the value of V is infinite. Therefore, in order to obtain the bounded topological surface, it is necessary to cut the V direction at least. The corresponding TCL script is as follows:
#2. View the pcurves of a cylinder faceCylinder C1#Trim the cylinder to (u,v)->[0, 2pi][0, 1]Trim C C0 2*pi0 1#Make the topo facemkface c c#Extract the 2d curve of an edge in a facePcurve C#display pcurves in 2d viewerAv2d2dfitfit#display face in 3d viewerVdisplay C
The build results are as follows:
Figure 2.6 Cylinder Pcurves
The pcurves of cylindrical faces is also closed in counter-clockwise order, according to the coloring rules of pcurve. The results of its display in three dimensions are as follows:
Figure 2.7 Cylinder face in 3d Viewer
3.3 Cone Pcurve
The parametric equation of the conical surface in the Opencascade is:
It is known that the conical surface is bounded in u direction and unbounded in v direction, just like the cylindrical surface. The Tcl script to crop the resulting topology and display Pcurve is as follows:
#3. View the pcurves of a cone faceCone Co - 0#Trim the cone to (u,v)->[0, 2pi][0, 1]Trim Co CO0 2*pi0 1#Make the topo faceMkface Co Co#Extract PcurvesPcurve Co#display pcurves in 2d viewerAv2d2dfitfit#display face in 3d viewerVdisplay Co
The build results are as follows:
Figure 2.8 Cone Pcurves
The pcurves of conical faces is also closed in counter-clockwise order, according to the coloring rules of pcurve. The results of its display in three dimensions are as follows:
Figure 2.9 Cone face in 3D Viewer
3.4 Sphere Pcurve
The parametric equation of the spherical surface in Opencascade is:
By the above parameter equation, the spherical surface is bounded in both U and V direction, so it can be generated without clipping it, and of course it can be clipped to the spherical part. The Tcl script that displays the spherical pcurves is as follows:
# 4. View the pcurves of a sphere face1# make the topoface# extr Act pcurvespcurve s# display pcurves in 2d viewerav2d2dfitfit# display sphere face in 3d viewerVdisplay s
The build results are as follows:
Figure 2.10 Sphere Pcurves
The pcurves of the spherical surface is also closed in counter-clockwise order, according to the coloring rules of pcurve. The results of its display in three dimensions are as follows:
Figure 2.11 Sphere in 3d Viewer
3.5 Torus Pcurve
The parametric equation of the torus in the Opencascade is:
The parametric equation of the torus shows that both U and V are bounded on the parameter range, so it is possible to generate a topological surface without clipping it, and of course it can be clipped to the torus part. The TCL script showing the torus pcurves is as follows:
# 5. View the pcurves of a torusface5# make the topofacemkface t t# extract pcurvespcurve t# display pcurves in 2d viewer Av2d2dfitfit# display torus in 3d viewerVdisplay t
The build results are as follows:
Figuer 2.12 Torus pcurves
The pcurves of the torus is also closed in counter-clockwise order, according to the coloring rules of pcurve. The results of its display in three dimensions are as follows:
Figure 2.13 Torus in 3d Viewer
3.Pcurve of a face with Holes
The OpenGL Programming Guide [10] shows that to crop a nurbs surface, you can create Glupwlcurve and glunurbscurve to form a closed area in the parametric space. Where Glupwlcurve is created is a multi-segment line, and Glunurbscurve generates a NURBS curve in the unit parameter space. When you create a clipping curve, you need to consider the direction (orientation) of the curve, that is, whether the curve is clockwise or counterclockwise. The way the curve cuts the surface is simple, imagine you go along the curve, the left hand side will be preserved, the right hand side will be removed.
Figure 3.1 Parametric trimming Curves
The clipping curve must also be closed and not self-intersection (trimming curves must be closed and nonintersecting). The clipping curve here is the same concept as the parametric curve pcurve in Opencascade. Polygons in Opencascade are also the same rules used. Below, the Tcl script is used to test whether the pcuve of the Opencascade face with an open hole satisfies the rules for clipping surfaces in OpenGL.
# test face with one hole - ten-12bop P cbopcut svdisplay Sexplode s Fpcurve s_1av2d2dfitfit
The Tcl script above is to use a cylinder to dig a hole in a plane, as shown in:
Figure 3.2 face with a Hole
Traverse the surface of the shape obtained by the Dug hole (Boolean operation) and get a face that shows the pcurve of the polygon as shown:
Figure 3.3 Pcurve of a face with one hole
By 3.3, the Pcurve rule is consistent with the clipping curve in OpenGL. The pcurve of the hole is blue, which is counter-clockwise: clockwise. Does the above rule still meet when multiple holes are generated on a polygon? Use TCL to verify the following:
# Test pcurve of a face with Multi-holes Ten 1 1-5-5- 55 -bop s c1bopcut sbop s c2bopcut sexplode s Fpcurve s_1av2d2dfitfit
Create four holes in a sphere using a script, as shown in:
Figure 3.4 A sphere face with 4 holes
Traversing the face of a shape after a Boolean operation creates a hole, you can see that only one polygon is generated. Display the pcurve of this face as shown:
Figure 3.5 Pcurves for a sphere with 4 holes
By 3.5, the orientation of the pcurve is also consistent with the orientation of the clipping curve in OpenGL. When D and E in the hole 3.1 generated by a polygon, how is it represented in the Opencascade? There are also TCL script test tests below:
- ten-51bop P tbopcut svdisplay sexplode s Fpcurve S_1pcurve S_2av2d2dfitfit
The build results are as follows:
Figure 3.6 A Plane cut a Torus
Figure 3.7 Pcurves for the Faces
It is known that when a plane is stripped of a torus, two polygons are generated, and some of the geometries are represented by a linked list to represent the result as a polygon, and the result is generated by two polygons in Opencascade. The orientation of the pcurves is also consistent with the orientation of the clipping curve in OpenGL.
4.Conclusion
To sum up, the concept of curved pcurve on curved surface is a very important concept, and understanding pcurve is of great significance for modeling and visualization. In this paper, the rules of the clipping curve in OpenGL and the command of the Pcurve in the Opencascade Draw test harness are presented to examine the orientation of the pcurve of the base surface and the clipping surface. By mastering these rules, it is convenient to test the correctness of the topological surface.
5. Acknowledge
Time flies, from graduation to now inadvertently to the had been. The vicissitudes of life, Canhong, experience the Four seasons of spring and autumn, taste the ups and downs. Thank you all the way, relatives, friends, colleagues and so on to give me the support, trust and encouragement, so I can do what I like, to find the direction of life.
Send a Sea of heaven and earth, one of the sea millet. Ready to go back home to work near Wuhan, switch to life mode, more time to accompany their parents to the family, to report the grace of upbringing.
6. References
1. Shing Liu. Pcurve-curve on Surface.
Http://www.cnblogs.com/opencascade/p/3601859.html
2. Shing Liu. Topology and Geometry in Opencascade-edge.
Http://www.cnblogs.com/opencascade/p/3604052.html
3. Topology and Geometry in Opencascade-face.
Http://www.cnblogs.com/opencascade/p/3605729.html
4. Shing Liu. Mesh algorithm in Opencascade. Http://www.cnblogs.com/opencascade/p/3648532.html
5. Shing Liu. Delaunay triangulation in Opencascade.
Http://www.cppblog.com/eryar/archive/2013/05/26/200605.aspx
6. Shing Liu. Triangle-delaunay Triangulator.
Http://www.cnblogs.com/opencascade/p/3632705.html
7. Opencascade, Draw Test Harness User Guide.
8. Opencascade, BRep Format white Paper.
9. Richard S. Wright Jr., Benjamin Lipchak. OpenGL superbible. Sams Publishing. 2004
Ten. Dave Shreiner. OpenGL Programming Guide. Addison-wesley. 2009
PDF Version:opencascade Pcurve of topological face
Opencascade Pcurve of topological face