geofmt.h
来自「算断裂的」· C头文件 代码 · 共 289 行
H
289 行
/*// ------------------------------------------------------------------// GeoFmt.h//// This file contains the definitions of the class Brep, and its// nested classes. This is a C file.// ------------------------------------------------------------------// Author: Paul "Wash" Wawrzynek, Chris Myers, and Stephen Vavasis// Copyright (c) 1999 by Cornell University. All rights reserved.// // See the accompanying file 'Copyright' for authorship information,// the terms of the license governing this software, and disclaimers// concerning this software.// ------------------------------------------------------------------// This file is part of the QMG and CPTC software. // Version 2.0 of QMG, release date September 3, 1999.// ------------------------------------------------------------------*//*Remarks:1. This is the header file for the data structures that define a Bezier surface geometry. 2. Terminology use for geometrical and topological entities isas follows: topology geometry 0D vertex point1D edge curve2D surface patch3D region --3. An object is comprised of one or more topological region.Regions are bounded by one or more topological faces.Topological surfaces comprise one or more Bezier patches.Topological surfaces are bounded by one or more topological edges.Topological edges comprise one or more Bezier curves.Topological edges bounded by an even number of topological vertices.Each topological vertex comprises exactly one control point.4. Currently curves are represented as Bezier curves of any order.Patches can be either triangular or quadrilateral. Both areBezier surfaces, the quadrilateral patches are tensor productpatches. 5 Each topological face (entity) has a property/value list associatedwith it, which is a property followed by a value.6. Geometry is defined by a table of control points. The ordering forcurves and surfaces is as follows:1D Bezier Curves - Bezier curves are defined by a polynomial order, and (order+1) control points.Triangular Bezier Patches - Triangular Bezier patches are defined by an order, and (order+1)*(order+2)/2 control points. Following Farin [1], Control points for triangular Bezier patches are ordered as follows (shown here for a 4th order surface, but this pattern generalizes for patches of any order) ^ v / / b[0,4,0] b[0,3,1] b[1,3,0] b[0,2,2] b[1,2,1] b[2,2,0] b[0,1,3] b[1,1,2] b[2,1,1] b[3,1,0] b[0,0,4] b[1,0,3] b[2,0,2] b[3,0,1] b[4,0,0] --> u These control points are stored in a list with the following indices: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 the macro TRI_INDX(i,j,k) maps from the three parameter logical ordering to a sequential index (the j argument is not used, but is included to make code more readable. Quadrilateral Bezier Patches - Quadrilateral Bezier patches are defined by an order in the "u" direction, an order in the "v" direction (u and v are surface parametric coordinates) and (order_u+1)*(order_v+1) control points. The control points for a 5(u) by 3(v) patch are ordered as follows ^ v | | b[0,3] b[1,3] b[2,3] b[3,3] b[4,3] b[5,3] b[0,2] b[1,2] b[2,2] b[3,2] b[4,2] b[5,2] b[0,1] b[1,1] b[2,1] b[3,1] b[4,1] b[5,1] b[0,0] b[1,0] b[2,0] b[3,0] b[4,0] b[5,0] ---> u These control points are stored in a list with the following indices: 18 19 20 21 22 23 12 13 14 15 16 17 6 7 8 9 10 11 0 1 2 3 4 57. For the triangular and quadrilateral patches, if the control pointsare ordered as shown above, the positive normal to the surfacewill point outward towards the viewer.8. It is assumed the normal directions for all the patches ofa topological face are "consistent", meaning they all point into spaceon the same side of the face.9. A topological region stores a list of bounding topological facesand a list of surface orientation flags. If the surface orientationflag is cleared (0), the normal direction for the face is taken asthat implicitly given by the geometry of the constituent surfaces.If the flag is set (<>0), a reverse normal direction is assumed.10. The surface orientation flags for the topological surfaces boundinga topological region are assumed to be set so that a positive normalpoints outward from the region.11. Surfaces internal to a region (e.g., cracks) should appear inthe regions face list twice, one with the orientation flag set, anda second time with the orientation flag cleared. 12. It is assumed that adjacent patches are "compatible" along theircommon edge. That is, the geometric description of the commonedge is identical when evaluated from the control points of eithersurface. If there is a mismatch in the order of the adjacent surfacesit is the responsibility of the geometry generator to insure that the computability condition is enforced.13. It is assumed that the edge between two adjacent patches is"compatible" with both patches in the sense that the geometryderived from evaluting using the edge's control is the same aswhat is obtained by evaluating the geometry along the appropriateedges of either of the patches.14. It is assumed that if two control points bound a curve, that thebounded curve is unique. That is, two control points cannot be joinedby more than one curve.15. Each topological entity has an id string, assumed to be unique.[1] Farin, Gerald, Curves and Surfaces for Computer Aided Geometric Design, A Practical Guide, Academic Press, 1988Version 1.1 19-May-98*/#ifndef Cptc_GeoFmt_h#define Cptc_GeoFmt_h/* The ID of topological faces is a null-terminated string. */typedef char* Cptc_ID_type;/* geometrical entities */typedef struct Cptc_GPoint_ { double coord[3] ; /* Cartesian coordinates */}Cptc_GPoint ;typedef struct Cptc_GCurve_ { int order ; /* Bezier curve order */ int* control_pnt_indx ; /* indices of (order+1) control pts */}Cptc_GCurve ;#define CPTC_PATCHTYPE_TRIANGLE 0#define CPTC_PATCHTYPE_QUAD 1typedef struct Cptc_GPatch_ { int type ; int order_u, order_v ; /* Bezier order in the u and v directions (order_v is ignored for triang patches */ int* control_pnt_indx ; /* For triangle: indices of (order_u+1)*(order_u+2)/2 control pts. For quadrilateral: indices of (order_u+1)*(order_v+1) control pts. */}Cptc_GPatch ;/* topological entities */typedef struct Cptc_TVertex_ { Cptc_ID_type id ; /* identification string */ int control_pnt_indx ; /* index of the control point */ int num_properties ; /* number of properties */ char** props; /* Array of properties */ char** values; /* array of values; must have the same number of entries as props */}Cptc_TVertex ;typedef struct Cptc_TEdge_ { Cptc_ID_type id ; /* identification string */ int num_curves ; /* number of Bezier curves */ Cptc_GCurve* curves ; /* list of curve descriptions */ int num_bound_vertices ; /* number of bounding top vertices (zero if a loop) */ int* bound_vertices ; /* list of indices of bounding verts */ int num_properties ; /* number of properties */ char** props; /* array of properties */ char** values; /* array of values */}Cptc_TEdge ;typedef struct Cptc_TSurface_ { Cptc_ID_type id ; /* identification string */ int num_patches ; /* number of Bezier patches */ Cptc_GPatch* patches ; /* list of surface descriptions */ int num_bound_edges ; /* number of bounding top edges (zero if a closed surface) */ int* bound_edges ; /* list of indices of bounding edges */ int num_bound_vertices; /* Number of internal boundary vertices */ int* bound_vertices; /* internal boundary vertices */ int num_properties ; /* number of properties */ char** props; /* array of properties */ char** values; /* array of values */}Cptc_TSurface ;typedef struct Cptc_TRegion_ { Cptc_ID_type id ; /* identification string */ int num_bound_surfaces ; /* number of bounding top surfaces */ int* bound_surfaces ; /* list of indices of bounding surfaces */ int num_bound_edges; /* Number of internal bounday edges */ int* bound_edges; /* List of internal boundary edges */ int num_bound_vertices; /* Number of topological boundary vertices */ int* bound_vertices; /* List of topological boundary vertices */ int* surface_orientation ; /* This array has the same length as bound_surfaces */ /* 0 => oriented as in the geometry 1 => reversed normal orientation 2 => orientation not specified */ int num_properties ; /* number of properties */ char** props ; /* table of properties */ char** values; /* table of values */}Cptc_TRegion ;/* Geometrical model description */typedef struct Cptc_GeomDesc_ { int intrinsic_dimension ; /* intrinsic dimension of model */ int embedded_dimension ; /* embedded dimension of model */ int num_properties; /* properties of object as a whole, */ char** props; /* including global id */ char** values; int num_control_pts ; /* number of control points */ int num_top_vertices ; /* number of topological vertices */ int num_top_edges ; /* number of topological edges */ int num_top_surfaces ; /* number of topological faces */ int num_top_regions ; /* number of topological regions */ Cptc_GPoint* control_points ; /* array of control points */ Cptc_TVertex* top_vertices ; /* array of top vertex descriptions */ Cptc_TEdge* top_edges ; /* ary of top edge descriptions */ Cptc_TSurface* top_surfaces ; /* array of top surface descriptions */ Cptc_TRegion* top_regions ; /* array of top region descriptions */}Cptc_GeomDesc ;/* macros */#define CPTC_TRI_INDX(i,j,k) (((i)+(k))*((i)+(k)+1)/2+(i))#define CPTC_QUAD_INDX(i,j,ord_u) ((j)*((ord_u)+1)+(i))#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?