// PK_CURVE_intersect_curve finds the intersections between specified regions of two curves.
PK_ERROR_code_t PK_CURVE_intersect_curve
(
--- received arguments ---
PK_CURVE_t curve_1, --- first curve
PK_INTERVAL_t interval_1, --- first interval
PK_CURVE_t curve_2, --- second curve
PK_INTERVAL_t interval_2, --- second interval
const PK_CURVE_intersect_curve_o_t *options, --- options structure
--- returned arguments ---
int *const n_vectors, --- number of intersections
PK_VECTOR_t **const vectors, --- positions of intersections
double **const ts_1, --- parameters on curve_1
double **const ts_2, --- parameters on curve_2
PK_intersect_vector_t **const types --- types of intersections
)
返回参数里面包含了交点position、param1、param2和type,需要type是为了标记记录一些相切等特质。
求交里面提到,交点将会按照curve_1的参数排列:The intersections are ordered along the first curve, ‘curve_1’, and are classified according to the direction of this curve.
The intersection types are returned in an array of length ‘n_vectors’. These can be one of:
PK_intersect_vector_simple_c: : A simple intersection not adjoining a region of coincidence. For PK_CURVE_intersect_curve, this includes tangent intersections.
PK_intersect_vector_start_c: : An intersection at the start of a region of coincidence.
PK_intersect_vector_end_c : An intersection at the end of a region of coincidence.
PK_intersect_vector_tangent_c is not returned by PK_CURVE_intersect_curve.
注: Whether an intersection is at the start or end of a region of coincidence is determined by the direction of the first curve, ‘curve_1’.
Specific Errors:
PK_ERROR_bad_parameter (MILD) bad parameter given
PK_ERROR_not_on_surface (MILD) curve does not lie on common surface
PK_ERROR_mixed_geometry (MILD) cannot intersect foreign curves with polylines
PK_ERROR_cant_do_intersect (SERIOUS) intersection cannot be done
struct PK_CURVE_intersect_curve_o_s
{
int o_t_version; — version number of option structure
PK_LOGICAL_t have_box; — whether box provided (PK_LOGICAL_false)
PK_BOX_t box; — box of interest
PK_SURF_t common_surf; — surf containing curves or
— PK_ENTITY_null (PK_ENTITY_null)
};
typedef struct PK_CURVE_intersect_curve_o_s PK_CURVE_intersect_curve_o_t;
Holds optional controls on intersections between two curves.
A surface may be supplied in the options structure which contains both the curves, the function will work without this surface but it may be more efficient to supply it.
这里提到,如果求交的两条曲线有公共的surface,可以提供出来,能加快计算效率。对于某些特殊的曲线,确实可以提效。
‘box’ describes the box that contains the area of interest. All intersections inside this box will be returned, but ones outside it may not be. The box may be used for efficiency. The box must be of type PK_BOX_t.
这个地方还提到,可以提供box来指定感兴趣的求交区域,也是用来加速计算的。提供box也是在options里面设置。
Any B-curve, B-surface or offset surface must be capable of passing the full checks imposed by PK_GEOM_check. // 顺便提到,对于B-curve, B-surface or offset surface的求交,必须能通过几何检查。
// PK_SURF_intersect_curve finds the intersections between a surface and a curve.
PK_ERROR_code_t PK_SURF_intersect_curve
(
--- received arguments ---
PK_SURF_t surf, --- surface
PK_CURVE_t curve, --- curve
PK_INTERVAL_t bounds, --- interval
const PK_SURF_intersect_curve_o_t *options, --- options structure
--- returned arguments ---
int *const n_vectors, --- number of intersections
PK_VECTOR_t **const vectors, --- positions of intersections
PK_UV_t **const uvs, --- parameters on surface
double **const ts, --- parameters on curve
PK_intersect_vector_t **const types --- types of intersections
)
返回参数将返回curve_surf_int对象数组,每个curve_surf_int里面包括交点、param、uv和type。
The intersection types are returned in an array of length ‘n_vectors’. There are four types of intersection, as follows:
PK_intersect_vector_simple_c : A simple intersection not adjoining a region of coincidence.
PK_intersect_vector_tangent_c: The curve touches the surface at a point.
PK_intersect_vector_start_c : An intersection at the start of a region of coincidence.
PK_intersect_vector_end_c : An intersection at the end of a region of coincidence.
The surface parameters in ‘uvs’ are only valid for simple and touch intersections. For coincident intersections the values in ‘uvs’ are not defined. // 这里提到,对于重合的情况,uvs参数没有定义。
Specific Errors:
PK_ERROR_invalid_geometry invalid geometry
PK_ERROR_not_on_curve given parameters not on curves
PK_ERROR_bad_end_points bad end points
PK_ERROR_bad_parameter bad parameter given
PK_ERROR_cant_do_intersect intersection cannot be done
PK_ERROR_mixed_geometry cannot intersect foreign and facet geometry
struct PK_SURF_intersect_curve_o_s
{
int o_t_version; — version number of option structure
PK_LOGICAL_t have_box; — whether box provided (PK_LOGICAL_false)
PK_BOX_t box; — box of interest
};
typedef struct PK_SURF_intersect_curve_o_s PK_SURF_intersect_curve_o_t;
Holds optional controls on intersections between a surface and a curve.
If the curve is a trimmed curve the supplied bounds are ignored. However a valid interval should be supplied. // 这个地方提到,如果提供的curve是一个trimmed curve,那么这个传入的参数域range将会被忽略。前提是,参数域有效。
a box is provided in the next field ‘box’, this describes the box that contains the area of interest. The box is used to improve performance. No guarantee is made that all the intersections returned will lie in it. // 这里提到,提供的包围盒加速,但是不能保证,所有返回的交点都在包围盒内。包围盒只是很简单的用来加速。
同样,对于B-curve, B-surface or offset surface的求交,必须能通过几何检查。
PK_ERROR_code_t PK_SURF_intersect_surf
(
--- received arguments ---
PK_SURF_t surf_1, --- surface_1
PK_SURF_t surf_2, --- surface_2
const PK_SURF_intersect_surf_o_t *options, --- options structure [PF]
--- returned arguments ---
int *const n_vectors, --- number of point intersections
PK_VECTOR_t **const vectors, --- posns of point intersections
int *const n_curves, --- number of intersection curves
PK_CURVE_t **const curves, --- intersection basis curves
PK_INTERVAL_t **const bounds, --- bounds of curves
PK_intersect_curve_t **const types --- types of intersections
)
PK_SURF_intersect_surf finds the intersections between two surfaces.
This function offers partial support for facet geometry [PF]
返回参数将返回surf_surf_int对象数组,每个surf_surf_int里面包括交点、uv1、uv2、交线、交线的参数域和type。// 或者将交点和交线分开。
The returned points (‘vectors’) will be returned at points where the surfaces make point contact. ‘n_vectors’ indicates the number of intersection points.
The curves returned (‘curves’) will be the basis curves of trimmed curves, and their corresponding bound in ‘bounds’, ‘n_curves’ indicates
the number of curves returned.
‘types’ classifies curves as being either:
PK_intersect_curve_simple_c : Simple intersection curves
PK_intersect_curve_tangent_c: Tangent intersection curves
两个曲面相交,可能相切于一点,也可能交出一条曲线。
相交于一条曲线的情况比较常见,用的比较多。交于一条曲线又分为:交叉相交和相切两种。
Specific Errors:
PK_ERROR_bad_option_data (MILD) bad option structure data
PK_ERROR_bad_shared_entity (MILD) surfaces must both be orphans or from same body
PK_ERROR_not_in_same_partition (MILD) surfaces in different partitions
PK_ERROR_bad_combination (MILD) an unsupported combination of classic and facet geometry has been supplied
PK_ERROR_not_on_curve (SERIOUS) given parameters not on curves
PK_ERROR_cant_do_intersect (SERIOUS) intersection cannot be done
struct PK_SURF_intersect_surf_o_s
{
int o_t_version; --- version number of option structure
PK_LOGICAL_t have_box; --- whether box provided --- (PK_LOGICAL_false)
PK_BOX_t box; --- box of interest
PK_LOGICAL_t have_uvbox_1; --- whether box provided for surf_1 --- (PK_LOGICAL_false) [NF]
PK_UVBOX_t uvbox_1; --- uvbox for surf_1 [NF]
PK_LOGICAL_t have_uvbox_2; --- whether box provided for surf_2 --- (PK_LOGICAL_false) [NF]
PK_UVBOX_t uvbox_2; --- uvbox for surf_2 [NF]
PK_LOGICAL_t have_vector; --- whether seed vector provided --- (PK_LOGICAL_false)
PK_VECTOR_t vector; --- only return branch containing --- the seed
PK_mixed_intersection_t mixed_curve_category;
--- return polyline, classic, or both as the intersection curve
--- (PK_mixed_intersection_pline_c)
double tolerance; --- for future use
};
typedef struct PK_SURF_intersect_surf_o_s PK_SURF_intersect_surf_o_t;
首先,两个曲面求交,是需要或者说可以传入uv参数区间的,所以就会有surf1和surf2的两个uvbox,用于指定求交的参数区间。
其次,在某些地方,为了加速求交,可以传入交点的大概的3dbox,然后求交的时候,在该区域开始迭代,加速计算。
所以会有两个uvbox参数和一个box参数。
The option structure defines options applicable to the intersection of two surfaces.
The option ‘have_box’ indicates whether a box has been specified (default = PK_LOGICAL_false)
The option ‘box’ enables a 3-space box of interest to be supplied. The box may be used to improve performance. The intersection curves returned are not guaranteed to lie within the bounds of the box.
// 这里提到,提供的3d包围盒加速,但是不能保证,所有返回的交点都在包围盒内。包围盒只是很简单的用来加速。
无
PK_ERROR_code_t PK_FACE_intersect_curve
(
--- received arguments ---
PK_FACE_t face, --- face
PK_CURVE_t curve, --- curve
PK_INTERVAL_t bounds, --- bounds of curve
--- returned arguments ---
int *const n_vectors, --- number of intersections
PK_VECTOR_t **const vectors, --- positions of intersections
PK_UV_t **const uvs, --- parameters on face's surface
double **const ts, --- parameters on curve
PK_TOPOL_t **const topols, --- topological entities intersected
PK_intersect_fc_t **const types --- types of intersections
)
PK_FACE_intersect_curve finds the intersections between a face and the specified region of a curve.
PK_ERROR_code_t PK_FACE_intersect_surf
(
--- received arguments ---
PK_FACE_t face, --- face
PK_SURF_t surf, --- surface
const PK_FACE_intersect_surf_o_t *options, --- options structure [PF]
--- returned arguments ---
int *const n_vectors, --- number of point intersections
PK_VECTOR_t **const vectors, --- posns of point intersections
int *const n_curves, --- number of intersection curves
PK_CURVE_t **const curves, --- intersection curves
PK_INTERVAL_t **const bounds, --- bounds of curves
PK_intersect_curve_t **const types --- types of intersections
)
PK_FACE_intersect_surf finds the intersections between a face and a surface.
This function offers partial support for facet geometry [PF]
PK_ERROR_code_t PK_FACE_intersect_face
(
--- received arguments ---
PK_FACE_t face_1, --- first face
PK_FACE_t face_2, --- second face
const PK_FACE_intersect_face_o_t *options, --- options structure [PF]
--- returned arguments ---
int *const n_vectors, --- number of point intersections
PK_VECTOR_t **const vectors, --- posns of point intersections
int *const n_curves, --- number of intersection curves
PK_CURVE_t **const curves, --- intersection curves
PK_INTERVAL_t **const bounds, --- bounds of curves
PK_intersect_curve_t **const types --- types of intersections
)
PK_FACE_intersect_face finds the intersections between two faces.
This function offers partial support for facet geometry [PF]
@file cucuint.hxx
// The general curve-curve intersection routine (in cucuint.cxx). It just switches on curve type to code which deals with the specific types. The result is a list of curve_curve_ints in increasing order of SPAparameter on the first curve.
DECL_INTR curve_curve_int *int_cur_cur(
curve const &,
curve const &,
SPAbox const & = *(SPAbox *)NULL_REF,
double = SPAresabs
);
cci_inf.hxx
// Function d3_cu_cu_int finds all intersections between two curves. It returns the results in the ACIS form, i.e. as a linked list of curve_curve_ints.
// Input Arguments:
// const curve& cu0 - first curve
// const SPAinterval& range0 - SPAparameter range on first curve
// const curve& cu1 - second curve
// const SPAinterval& range1 - SPAparameter range on second curve
// Only intersections within both SPAparameter ranges are returned If either supplied SPAinterval is null, or references a null pointer, then the full curve is used.
// double epsilon - the resolution distance
// Close approaches of the curves are treated as intersections if the minimum separation is less than epsilon.
// Return Arguments:
// curve_curve_int* d3_cu_cu_int - linked list of intersections
extern DECL_INTR curve_curve_int* d3_cu_cu_int( const curve& cu0, const SPAinterval& range0,
const curve& cu1, const SPAinterval& range1,
double epsilon =SPAresabs );
curve_curve_int求交结果参数:
@file intcucu.hxx
SPAposition int_point
curve_curve_rel high_rel
curve_curve_rel low_rel
curve_curve_int * next
double param1
double param2
curve_curve_userdata * userdata
SPApar_pos uv
logical uv_set
1). high_rel, low_rel
high_rel :Relation @href curve_curve_rel of curves on the higher-parameter side of curve1.
low_rel :Relation @href curve_curve_rel of curves on the lower-parameter side of curve1.
curve_curve_rel
Classify a curve-curve intersection.
Role: We do not have a sense of inside or outside, but can recognise tangencies and regions of coincidence.
Enumerator:
cur_cur_unknown
cur_cur_normal
cur_cur_tangent
cur_cur_coin
四种交点类型。
Parameters:
cur_cur_unknown No comment on relationship.
cur_cur_normal Normal angular intersection.
cur_cur_tangent Curves are tangent (or antitangent), but not coincident.
cur_cur_coin Curves are coincident over an extended region.
2). param1,param2
param1 :Intersection parameter on curve1
param2 :Intersection parameter on curve2
3). curve_curve_userdata
Pointer to an arbitrary object to store user data.
Role: If non-NULL, it is deleted when this object is deleted. It is the responsibility of the user’s class derived from this to ensure that the destructor does what is necessary.
4). uv
Surface parameters if the curves are known to lie on a surface.
5). uv_set
TRUE if the surface parameters have been set - FALSE by default.
@file intcusf.hxx
// This is the general (lower-case) curve-surface intersection routine (in intcusf.cxx). Depending on the curve and surface types, it calls the specific routines below, returning a pointer to a chain of curve_surf_int's on the heap.
DECL_INTR curve_surf_int *int_cur_sur(
curve const &,
surface const &,
curve_bounds &,
SPAbox const & = *(SPAbox *)NULL_REF
);
// Tolerant intersection version, internally both use the same code
DECL_INTR curve_surf_int *int_cur_sur(
curve const &,
surface const &,
curve_bounds &,
double const,
SPAbox const & = *(SPAbox *)NULL_REF
);
curve_surf_int结果参数:
@file cusfint.hxx
const void * data1
const void * data2
logical fuzzy
SPAposition int_point
SPAparameter high_param
SPAparameter low_param
curve_surf_rel high_rel
curve_surf_rel low_rel
curve_surf_int * next
SPAparameter param
SPApar_pos surf_param
double tolerance
curve_surf_userdata * userdata
1). data1, data2
#ifndef NO_MESH_CLASSES
data1: General purpose pointer used to store the element on a meshsurf from which this intersection originated.
data2: General purpose pointer used to store the element on a compcurv from which this intersection originated.
2). fuzzy
@nodoc INTERNAL USE ONLY: This is TRUE if the intersection is not tightly defined (a tangency or small-angle crossing).
在实际计算交点的时候,特别是这里提到的,对于相切或者小角度的crossing求交,交点的位置计算并不精确。从实际精确交点的左边附近迭代和从右边附近迭代,得到的结果是不一样的。这种情况下,如果标记为fuzzy并且计算出high_param, low_param对于后续的处理和稳定性是有很大作用的。
3). high_param, low_param
high_param : @nodoc INTERNAL USE ONLY: The high end of the parameter range if it is fuzzy; the same as param if it is not fuzzy.
low_param: @nodoc INTERNAL USE ONLY: The low end of the parameter range if it is fuzzy; the same as param if it is not fuzzy.
4). low_rel, high_rel
curve_surf_rel
low_rel :Returns relationship between curve and surface.
Role: The relationship between the curve and the surface in the neighborhood of the intersection, in the negative parameter direction.
high_rel :Relationship between curve and surface in the positive direction.
Role: The relationship between the curve and the surface in the neighborhood of the intersection, in the positive parameter direction.
因为在后面某些运算(例如布尔运算)的时候,我们可能需要用到一些位置关系,所以在这个求交打断的时候,就可以很方便把位置关系给推出来,后续可以直接用上。
curve_surf_rel
enum curve_surf_rel
Types of relationships between curves and surfaces.
Parameters
curve_unknown Relationship unknown.
curve_in Curve is inside surface, with a first-order approach.i.e. at the intersection point the curve tangent and the surface normal have a non-zero dot product. //交叉相交,(前一段/后一段)曲线在surface内部
curve_out The curve is outside the surface, with a first-order approach.
curve_in_tan The curve is inside the surface, but tangent to it.
curve_out_tan The curve is outside of the surface, but tangent to it.
curve_coin The curve is coincident with the surface
curve_dummy_coin The curve is coincident but there are no bounds by which to indicate the fact. This record only serves to show this - other fields are ignored.
Enumerator
curve_unknown
curve_in
curve_out
curve_in_tan
curve_out_tan
curve_coin
curve_dummy_coin
5). param, surf_param
param :The parameters of the intersection point on the curve.
surf_param:The parameters of the intersection point on the surface.
6). tolerance
Supports tolerant modeling.
Role: The value is used to record the tolerance value of the intersection. It is defaulted to SPAresabs.
7). userdata
Pointer to an arbitrary object to store user data.
Role: If non-NULL, it is deleted when this object is deleted. It is the responsibility of the user’s class derived from this to ensure that the destructor does what is necessary.
@file cusfint.hxx
curve bounds given the start and end relations, positions, and parameters. If the start or end relation is TRUE, it means that the start or end point, respectively, is on the surface. If the start position or end position is NULL, that side of the cure is unbounded for the intersection.
Public Attributes:
SPAposition start_point
SPAposition end_point
SPAparameter start_param
SPAparameter end_param
point_surf_rel start_rel
point_surf_rel end_rel
Private Attributes :
double start_tol
double end_tol
1). start_param,end_param
start_param: SPAparameter curve_bounds::start_param
The start parameter on the curve.
2). start_point,end_point
SPAposition curve_bounds::start_point
The start position, which can be NULL.
3). start_rel,end_rel
point_surf_rel curve_bounds::start_rel
The start relation.
Role: TRUE means that the start point is on the surface; FALSE means that the start point is off the surface.
See also point_surf_rel.
point_surf_rel
enum point_surf_rel
Types of point to surface relationships.
Parameters
no_end_point Point and its param are not initialized to anything meaningful.
point_unknown_surf Point at unknown location with respect to the surface.
point_off_surf Point not on the surface.
point_on_surf Point on the surface.
Enumerator
no_end_point
point_unknown_surf
point_off_surf
point_on_surf
3.4 start_tol,end_tol
double curve_bounds::start_tol : The tolerance of the start vertex
@file intsfsf.hxx
// Intersect the surfaces of two faces, returning zero or more curves. We may assume that every edge of each face has already been intersected with the other surface, so the intersection points may be used to assist us (for example if the surfaces are parametric).
// This is the general (lower-case) surface-surface intersection routine (in intsfsf.cxx). Depending on the types of the two surfaces, it calls the specific routines below, returning a pointer to a chain of surf_surf_int's on the heap.
DECL_INTR surf_surf_int *int_surf_surf(
surface const &,
FACE *,
SPAtransf const &,
surface const &,
FACE *,
SPAtransf const &,
SPAbox const & = *(SPAbox *)NULL_REF,
ssi_bool_info * = NULL
);
// Tolerant version of int_surf_surf
//
// Should be called when an intersection tolerance is required
DECL_INTR surf_surf_int *int_surf_surf(
surface const &,
surface const &,
double const,
SPAbox const & = *(SPAbox *)NULL_REF,
ssi_bool_info * = NULL,
SPApar_box const & = *(SPApar_box *)NULL_REF,
SPApar_box const & = *(SPApar_box *)NULL_REF
);
surf_surf_int求交结果参数:
@file sfsfint.hxx
Public Attributes :
surface * aux_surf
surf_surf_rel aux_left_rel [2]
curve * cur
double start_param
double end_param
surf_surf_term * start_term
surf_surf_term * end_term
surf_int_type int_type
surf_int_type left_int_type [2]
surf_int_type right_int_type [2]
surf_surf_rel left_surf_rel [2]
surf_surf_rel right_surf_rel [2]
pcurve * pcur1
pcurve * pcur2
surf_surf_int * next
int nsplit
double * split_param
Private Attributes :
double _tol
1). aux_surf
surface* surf_surf_int::aux_surf
Normally NULL, this points to a surface containing the intersection curve.
Role: It is roughly perpendicular to the subject surfaces if they are tangential or near tangential, which allows for clean intersections with the edges of the faces.
2). aux_left_rel
surf_surf_rel surf_surf_int::aux_left_rel[2]
For each of the surfaces, it specifies the relationship @href surf_surf_rel on the left side of the intersection curve to the auxiliary surface.
Role: Because this is always a clean “inside” or “outside,” the right relationship is always the converse, so it does not need to be recorded.
surf_surf_rel
enum surf_surf_rel
Types of surface-surface relation.
Role: Describes the type of relationship between two surfaces used to produce a curve from two intersecting surfaces.
Parameters
surf_unknown Unknow relationship.
surf_inside Surface is inside.
surf_outside Surface is outside
surf_coincident Coincidente surfaces.
surf_keep Surface is kept.
surf_discard Surface is discarded.
Enumerator
surf_unknown
surf_inside
surf_outside
surf_coincident
surf_keep
surf_discard
3). cur
当曲面重合的时候,可能为空。
curve* surf_surf_int::cur
Intersecting curve from the face-face coincidence, and it may be NULL.
Role: In this case, all face-body relationships are either surf_symmetric or surf_antisymmetric, and this is the only CURVE_LIST record in the list.
4). int_type
4-1). int_type
int_type
surf_int_type surf_surf_int::int_type
The classification of the intersection type @href surf_int_type .
surf_int_type
enum surf_int_type
Types of surface intersection.
Role: Describes the type of surface intersection in a curve produced by two intersecting surfaces.
Parameters
int_normal Normal (usual) intersection.
int_tangent Tangent or coincident intersection, with normals in the same direction.
int_antitangent Tangent or coincident intersection, with normals in opposite direction.
Enumerator
int_normal
int_tangent
int_antitangent
4-2). left_int_type ,right_int_type
#ifndef NO_MESH_CLASSES
left_int_type
surf_int_type surf_surf_int::left_int_type[2]
Intersection type @href surf_int_type with respect to other face of the portions of each face to the left of the intersection curve.
Role: Only used for mesh surface intersections (otherwise the single int_type above is sufficient). Set to int_unknown if not used.
// 仅用于mesh
#ifndef NO_MESH_CLASSES
right_int_type
surf_int_type surf_surf_int::right_int_type[2]
Intersection type @href surf_int_type with respect to other face of the portions of each face to the left of the intersection curve.
Role: Only used for mesh surface intersections (otherwise the single int_type above is sufficient). Set to int_unknown if not used.
// 仅用于mesh
5). left_surf_rel,right_surf_rel
交线左侧曲面在另外一个曲面内外的关系。// 方便未来布尔运算的时候内外关系判断。有了这些信息,face内外关系判断会简单很多,能提高效率。
surf_surf_rel surf_surf_int::left_surf_rel[2]
The relationships @href surf_surf_rel with respect to the other face of the portions of each face to the left of the intersection curve.
surf_surf_rel surf_surf_int::right_surf_rel[2]
The relationships @href surf_surf_rel with respect to the other face of the portions of each face to the left of the intersection curve.
6). start_term,end_term
交线的起始和终止(terminator)
surf_surf_term* surf_surf_int::start_term
The terminator point at the start of the curve.
Role: It is NULL if the curve is not bounded at the start.
surf_surf_term* surf_surf_int::end_term
The terminator point at the end of the curve.
Role: It is NULL if the curve is not bounded at the end.
surf_surf_term:包含了位置信息,参数uv,等
Public Attributes:
SPAposition term_pos
SPApar_pos term_uv1
SPApar_pos term_uv2
logical params_set // Set to TRUE if the term_uv? values have been set correctly. This is a temporary measure until all terminators get these values recorded at source.
surf_surf_term_cont cont
surf_surf_term_data * term_data // Pointer for client’s use, for additional data associated with the terminator. Always set NULL by the surface-surface intersector.
Private Attributes :
int use_count // Number of current references to this record.
double _tol // tolerance
surf_surf_term_cont
enum surf_surf_term_cont
@nodoc Describes the surface surface intersection terminator relationships.
Role: Enumeration to classify a terminator relative to the SPAbox used in the surface-surface intersection. In particular it indicates when a curve has left the SPAbox, and so does not need to be extended.
Parameters
surf_surf_term_unknown_box Unknown relationship
surf_surf_term_inside_box Inside box
surf_surf_term_outside_box Ouside box
Enumerator
surf_surf_term_unknown_box
surf_surf_term_inside_box
surf_surf_term_outside_box
7). start_param,end_param
交线的起始点和终止点的参数
double surf_surf_int::start_param
The parameter value of start_point, which is meaningless if the start_point is NULL.
double surf_surf_int::end_param
The parameter value of end_point, which is meaningless if the end_point is NULL.
8). pcur1,pcur2
交线在曲面上的参数曲线
pcurve* surf_surf_int::pcur1
The first pcurve, it provides the parametric-space intersection curve with respect to the intersection surfaces, if they are parametric.
Role: It may be NULL even if cur is not NULL.
pcurve* surf_surf_int::pcur2
The second pcurve, it provides the parametric-space intersection curve with respect to the intersection surfaces, if they are parametric.
Role: It may be NULL even if cur is not NULL.
9). nsplit
交线的分割点的个数
int surf_surf_int::nsplit
The number of values in the array split_param.
Role: This is 0 if split_param is NULL.
10). split_param
double* surf_surf_int::split_param
The terminator point at the start of the curve.
Role: It is NULL if the curve is not bounded at the start. An array of parameter values flagging bounded regions of the curve where it lies outside the region of interest. Each value is a typical parameter value within the portion outside the SPAbox. If no SPAbox was specified, or the intersection curve lies wholly within the SPAbox, or it is unbounded but only enters the SPAbox in one SPAinterval, then this pointer is NULL. Otherwise it must point to an array on the heap.
拓扑求交
Determine curve-curve or edge-edge Intersections.
Declared at <intrapi.hxx>, SPAintr.
api_inter_ed_ed()
DECL_INTR outcome api_inter_ed_ed ( EDGE * e1,
EDGE * e2,
curve_curve_int *& inters,
AcisOptions * ao = NULL
)
Intersects two edges, producing a list of curve-curve intersection records.
Role: The records contain the locations of the intersection and the nature of the intersection (coincident, etc.).
To turn the list of intersection records into the POINTs and EDGEs of the intersection, use @href api_ed_inters_to_ents.
Limitations:
• This API does not take body transforms into account.
Errors: Pointer to edge is NULL or not to an EDGE.
Effect: Changes model
Journal: Available
Product(s): 3D ACIS Exchange, 3D Viz Exchange, 3D ACIS Modeler
Parameters
e1 first edge.
e2 second edge.
inters list of intersection records returned.
ao ACIS options.
api_intersect_curves()
DECL_INTR outcome api_intersect_curves ( EDGE * crv1,
EDGE * crv2,
logical bounded,
curve_curve_int *& inters,
AcisOptions * ao = NULL
)
Intersects two edges or two curves, producing a list of curve-curve intersection records.
Role: This API returns a list of all intersections between the specified edges or their underlying curves. If bounded is TRUE, the API returns only intersections within the parameter ranges of both the edges (crv1 and crv2); otherwise, it returns intersections that occur on the extensions of the curves. However, extensions are only considered when both the curves are either straight lines or circles.
This API uses analytic equations when both the curves are either straight lines or circles. For more complex cases, it intersects the B-spline approximations associated with the two supplied curves. Thus, the intersection results returned by this API are for the approximate B-spline curves, and not for the true curve geometries. For accurate intersections corresponding to true curve geometries, use @href api_inter_ed_ed instead.
Limitations:
• If bounded is FALSE, the extensions of the input curves are not taken into account unless both the curves are either straight lines or circles.
Effect: Changes model
Journal: Available
Product(s): 3D ACIS Exchange, 3D Viz Exchange, 3D ACIS Modeler
Parameters
crv1 first curve.
crv2 second curve.
bounded find only intersections within edge bounds.
inters list of intersection records returned.
ao ACIS options.
@file boolapi.hxx
接口1:
DECL_BOOL outcome api_edfa_int ( EDGE * edge,
FACE * face,
ENTITY_LIST *& inter,
AcisOptions * ao = NULL
)
Computes the intersections between the given edge and the given face.
Role: This API function computes the intersections of a given edge with a given face. Then, it determines the containment of the intersections and constructs the edges or vertices, depending on whether the intersections are isolated or coincident. It returns the result in an entity_list as edges and vertices.
Errors: Pointer to edge is NULL or not to an EDGE. Pointer to face is NULL or not to a FACE.
参数:
Parameters
edge The given edge.
face The given face.
inter The intersection returned as an entity list.
ao ACIS options such as versioning and journaling.
接口2:
DECL_BOOL outcome api_edfa_int ( EDGE * edge,
FACE * face,
ENTITY_LIST *& inter,
BoolOptions * bool_opts,
AcisOptions * ao = NULL
)
Computes the intersections between the given edge and the given face.
Role: This API function computes the intersections of a given edge with a given face. Then, it determines the containment of the intersections and constructs the edges or vertices, depending on whether the intersections are isolated or coincident. It returns the result in an entity_list as edges and vertices.
Errors: Pointer to edge is NULL or not to an EDGE. Pointer to face is NULL or not to a FACE.
参数:
Parameters
edge The given edge.
face The given face.
inter The intersection returned as an entity list.
boolopts (in) Boolean options. Refer to @href BoolOptions for details.
ao ACIS options such as versioning and journaling.
outcome求交结果参数:
Private Member Functions :
problems_list * get_problems_ptr ()
Private Attributes :
err_mess_type quant
BULLETIN_BOARD * bb_ptr
error_info * e_info
problems_list * problems_ptr
err_mess_type [1/2]:
typedef int err_mess_type
An integer identifier that maps to a string.
Role: This is the type passed to sys_error and sys_warning to signify a particular error.
err_mess_type [2/2]:
typedef int err_mess_type
An integral value used by the ACIS message and error system to signify a message code. This is typically seen used with sys_warning, sys_error, and the message module system.
BULLETIN_BOARD:
一个比较复杂的的类,记录的信息比较多。这里只作简单介绍。
Contains a list of BULLETINS recording changes to ENTITYs during the current operation on the model.
Role: A BULLETIN_BOARD contains a list of BULLETINs, each of which records the changes to a single ENTITY during the current operation on the model.There are two types of current bulletin-board, mainline and stacked, and completed ones may be successful or failed, depending on the reported success of the completed operation. @See BULLETIN, DELTA_STATE, HISTORY_STREAM, DELTA_STATE, outcome 。
error_info:
Class for storing entity-based ACIS error information.
Role: This class is derived from error_info_base. In addition to holding the error number and severity associated with a problem, failure, or error encountered during an operation, instances of error_info are designed to hold pointers to an entity or entities involved in the failure. They can therefore be used by API functions that return entity-based information in their outcomes.
Error System process :
1.At the start of each API function, a global variable pointer to an error_info_base object is set to NULL.
2.Before @href sys_error is called, the global pointer is set to contain the relevant error_info_base object.
3.At the end of the API function, before the outcome object is returned, the global variable is examined, and if nonempty, an error_info instance is added to the outcome.
Two overloaded versions of the function sys_error set a global pointer to an error_info object. One version is passed an error_info object, whereas the other creates a standard_error_info object when sys_error is passed one or two ENTITYs. The standard_error_info class is derived from error_info.
In the Local Operations, Remove Faces, and Shelling Components, the error_info object returns an ENTITY that further specifies where the local operation first fails, when such information is available. A standard_error_info object is adequate for use in these components, and more detailed information could be returned, if necessary, by deriving a new class.
problems_list:
Global function to add a problem to the current problems_list。 This can be used to register problems which are warnings rather than fatal or failsafe errors. It can also be used in cases where failsafe behavior cannot be implemented using the API_FAILSAFE_BEGIN/END macros.
参数中输入/输出结果:
ENTITY_LIST *& inter,
returns the result in an entity_list as edges and vertices.
1). Class edge_face_int
说明:edge_face_int并不是上面求交接口api_edfa_int 的直接输出结果,但是既然有edge_face_int这个东西,那么就一定和edge-face求交有很大的关系,接口输出的结果可能是摘取了edge_face_int里面的部分返回结果信息。下面分析一下edge_face_int这个类。
Detailed Description:
Records information about edge-face intersections.
Role: This class records information about edge-face intersections.
Public Types
enum edge_face_rel { edge_face_unknown , edge_face_outside , edge_face_inside} // 没有解释。但是看参数,应该是记录了edge-face在交点处的内外关系。可用于在edge分割时,内外判断。
Public Member Functions:
edge_face_int (edge_face_int *ed_face, EDGE *ed, curve_surf_int *curv)
edge_face_int (edge_face_int const &ed_face, SPAposition const &pos, double dval)
Public Attributes :
section_line_rel this_section_line_rel
edge_face_int * next
curve_surf_int * cs_int
curve_surf_int * aux_cs_int
SPAposition int_point
SPAparameter param
double int_quality
EDGE * body_edge
VERTEX * body_vertex
BODY * owning_body
edge_face_rel rel
FACE * adj_face
VERTEX * graph_vertex
EDGE * graph_edge
logical edge_reversed
double edge_coincidence_tol
VOID_LIST pairs_list
logical crumbled
2). cs_int
curve_surf_int * cs_int
curve_surf_int* edge_face_int::cs_int
The pointer to geometric information. // 记录交点的几何信息。
3). this_section_line_rel
section_line_rel edge_face_int::this_section_line_rel
section_line_rel:
Private Attributes :
logical * _on_section_line // The array containing the relationship between the edge-face-int ad the section lines.
int _number_of_section_lines // The dimension of the array.
A new field for the edge-face-int to know whether it is located on a section line and to tell which one it is.
To know on which section line our edge_face_int is connected to.
看介绍应该是记录int位于哪一段上。但是具体的用途没想明白。
4). int_point,param
SPAposition edge_face_int::int_point
The position of the intersection in object space.
Role: It is initially the same as that in curve_surf_int, but may be adjusted within a neighborhood of the ideal position.
SPAparameter edge_face_int::param
Parameter on the edge corresponding to int_point.
Role: It is initially set to the parameter value from the curve_surf_int.
5). int_quality
double edge_face_int::int_quality
An indication of the reliability of this intersection, based on the sine of the angle between the face normals at the intersection.
Role: It is 1 for a right angled intersection and 0 at a tangency.
这个参数就有点意思了,表示交的可信度。因为对于相切或者近似相切的情况,交点的位置信息可能是不精确的(不可靠的)。是不是还可以将近似相切的也设置一个可信度??
6). body_edge,body_vertex,owning_body
EDGE* edge_face_int::body_edge
Pointer to the edge on which the intersection lies.
VERTEX* edge_face_int::body_vertex
Pointer to the vertex at the end of an edge if the intersection is at that end - else, it is NULL. // 记录交点与edge的顶点重合的情况,也就是vertex-face重合的特殊情况。
BODY* edge_face_int::owning_body
Pointer to the body in which the edge lies.
7). adj_face,aux_cs_int
FACE* edge_face_int::adj_face
Pointer to the adjacent face to the edge, for which the auxiliary information is valid. // 这个地方记录了edge关联的所有的face信息。说是auxiliary information is valid。
curve_surf_int* edge_face_int::aux_cs_int
The intersection between the edge curve and the auxiliary surface. // ?不太明白这个auxiliary surface指的是啥?
不太理解。也有可能这两个auxiliary指的不是同一个问题?
8). graph_vertex,graph_edge
VERTEX* edge_face_int::graph_vertex
Pointer to a vertex created for the intersection graph.
Role: It is initially set to NULL until the vertex is required. It may remain NULL if the intersection does not lie on any face lying on the surface.
EDGE* edge_face_int::graph_edge
Pointer to the intersection graph edge corresponding to the next portion of the current edge, in which there is a coincidence and in which edges have been created.
构造的vertex和edge的交图。
9). edge_reversed
logical edge_face_int::edge_reversed
Indicates if edges have opposite sense from the the body edge, if graph_edge_list is not NULL.
Role: If the graph_edge_list is not NULL and if the graph edges have the opposite sense from the body edge it is TRUE - else it is FALSE. It is ignored if the graph_edge_list is NULL.
10). pairs_list,crumbled
VOID_LIST edge_face_int::pairs_list
logical edge_face_int::crumbled
没有文档介绍和解释。
接口1:
@file boolapi.hxx
DECL_BOOL outcome api_fafa_int ( FACE * tool,
FACE * blank,
BODY *& graph,
AcisOptions * ao = NULL
)
Determines the intersection between two faces.
Role: This API function computes the intersection between two faces and returns the result as a wire body suitable for general use.
Note: Prior to ACIS 7.0 this function returned a specialized wire body (an intersection graph) containing extra coedges and Boolean attributes. Since ACIS 7.0 this function has returned a “cleaned” wire body.
Errors: tool or blank is a NULL pointer or does not point to a @href FACE.
Effect: Read-only on input. A new body is created.
Parameters:
tool (in) Tool face.
blank (in) Blank face.
graph (out) Returned intersection wire body.
ao (in) ACIS options such as versioning and journaling.
接口2:
DECL_BOOL outcome api_fafa_int ( FACE * tool,
FACE * blank,
BODY *& graph,
BoolOptions * bool_opts,
AcisOptions * ao = NULL
)
Determines the intersection between two faces.
Role: This API function computes the intersection between two faces and returns the result as a wire body suitable for general use.
Note: Prior to ACIS 7.0 this function returned a specialized wire body (an intersection graph) containing extra coedges and Boolean attributes. Since ACIS 7.0 this function has returned a “cleaned” wire body.
Errors: tool or blank is a NULL pointer or does not point to a @href FACE.
Effect: Read-only on input. A new body is created.
Parameters:
tool (in) Tool face.
blank (in) Blank face.
graph (out) Returned intersection wire body.
boolopts (in) Boolean options. Refer to @href BoolOptions for details.
ao (in) ACIS options such as versioning and journaling.
1). Class face_face_int
Public Member Functions :
face_face_int (double, edge_face_int *, COEDGE *, containment=on, tangency=none, logical body_edge_crumble=FALSE)
Public Attributes :
face_face_int * next
SPAposition int_point
double param
edge_face_int * ef_int_before
edge_face_int * ef_int_after
containment before
containment after
logical before_guessed
logical after_guessed
edge_face_int * primary_ef_int
COEDGE * entering_coedge
COEDGE * leaving_coedge
double entering_param
double leaving_param
tangency dir
crumble_state crumble
2). int_point,param
SPAposition int_point;
Position of this intersection.
double param;
Parameter value along intersection curve of this intersection point.
应该是指退化点的交?但是param是干啥的?
还是说交线的第一个交点?
3). containment: before, after
before;// SPAposition with respect to the face(s) just before this point
after; // SPAposition just after point
containment
enum containment
@nodoc
Enumerator
in
on
out
unknown
位置(包含)关系。
4). ef_int_after,ef_int_before
edge_face_int* face_face_int::ef_int_after
Pointer to edge-face intersection corresponding to “before” if “before” is “on”.
edge_face_int* face_face_int::ef_int_before
Pointer to edge-face intersection corresponding to “after” if “after” is “on”.
5). before_guessed,after_guessed
logical face_face_int::after_guessed
true if the before containment has been made “in” for lack of any better information。
logical face_face_int::before_guessed
true if the after containment has been made “in” for lack of any better information。
6). primary_ef_int
edge_face_int* face_face_int::primary_ef_int
Pointer to edge-face intersection used for up-to-date vertex information (if there is more than one ef_int referring to the same point).
// Note that the before and after ef_ints will be the same unless there is a body vertex at the intersection, and if neither “before” nor “after” is “on” the order of ef_ints is undefined.
7). entering_coedge, leaving_coedge
COEDGE *entering_coedge;
Pointer to coedge linking edge to the face on which it lies, leading into this intersection.
COEDGE *leaving_coedge;
Pointer to coedge linking edge to the face on which it lies, leading out of this intersection.
8). entering_param,leaving_param
double entering_param;
Parameter value on edge curve corresponding to entering_coedge.
// 4/29/03 bwc: The above comment did not seem very descriptive so I looked around in the code to see whether the param was w.r.t. the COEDGE, EDGE, or curve. From what I could tell, this param is w.r.t. the EDGE !!!
double leaving_param;
// Same for leaving_coedge.
9). dir
tangency dir;
direction relationship between curve and coedge, for the coedge corresponding to whichever of “before” and “after” is “on”. If neither is “on”, or both are and the directions are opposite, takes the value “none”.
10). crumble
crumble_state crumble;
无解释。
face_face_int的参数解释太少,很多东西我们不能清楚的知道是做什么用的,只能大致推测它记录了哪些信息。
对于几何求交,参数的解释和用途都介绍的比较清晰明白。
对于拓扑求交,很多参数都不太清楚意义和作用。只能大致推测求交记录了哪些信息,以备后续布尔运算的时候使用。
此外,由于布尔运算的复杂性,在计算的时候,尽量将有用的信息都记录下来,不要在使用时查询,能提高效率。
class Point3d
{
public:
private:
double m_data[3];
}
class Point2d
{
public:
private:
double m_data[2];
}
enum CrvCrvRelation
{
Unknown = 0,
Normal = 1,
Tangent = 2,
CoinStart = 3,
CoinEnd = 4
};
struct CurvCurvIntResult
{
double Param1; // param on curve1
double Param2; // param on curve2
CurvCurvRelation Type;
};
struct CurvCurv2dIntResult : public CrvCrvIntResult
{
Point2d IntPoint;
};
struct CurvCurv3dIntResult : public CurvCurvIntResult
{
Point3d IntPoint;
};
enum CurvSurfRelation
{
Curve_unknown = 0,
CurveIn = 1,
CurveOut = 2,
CurveTanIn = 3,
CurveTanOut = 4,
CurveCoinStart = 5,
CurveCoinEnd = 6,
CurveDummyCoin = 7
};
class CurvSurfIntResult
{
public:
Point3d intPoint;
double curvT; // param on curve
UVParam surfUV; // param on surface
// 如果是相切的,需要记录在容差范围内,多长一段近似重合
short fuzzy; // 求交结果的可信度。This is TRUE if the intersection is not tightly defined (a tangency or small-angle crossing).
double lowParam; // The low end of the parameter range if it is fuzzy; the same as param if it is not fuzzy.
double highParam; // The high end of the parameter range if it is fuzzy; the same as param if it is not fuzzy.
CurvSurfRelation highRel;
CurvSurfRelation lowRel;
// Supports tolerant modeling. Role: The value is used to record the tolerance value of the intersection.It is defaulted to SPAresabs.
double tolerance;
};
enum SurfSurfIntType
{
IntPoint = 0,
IntNormal = 1,
IntTangent = 2,
IntAntiTangent = 3
};
enum SurfSurfRelation
{
SurfUnknown = 0,
SurfInside = 1,
SurfOutside = 2,
SurfCoincident = 3,
SurfKeep = 4,
SurfDiscard
};
enum SurfSurfIntPtContain
{
UnknownBox,
InsideBox,
OutsideBox
};
class SurfSurfIntResult
{
public:
SurfSurfIntType type;
};
class SurfSurfIntPoint : public SurfSurfIntResult
{
public:
std::shared_ptr <Point3d> intPoint;
UVParam uv1; // surface1 uv
UVParam uv2; // surface2 uv
// Enumeration to classify a terminator relative to the SPAbox used in the surface-surface intersection.
SurfSurfIntPtContain contain;
// Supports tolerant modeling. Role: The value is used to record the tolerance value of the intersection.It is defaulted to SPAresabs.
double tol;
};
class SurfSurfIntCurve : public SurfSurfIntResult
{
public:
// 如果是一条交线
std::shared_ptr<Curve3d> intCurve;
// 交线的曲线的首末参数
double startParam;
double endParam;
SurfSurfIntPoint* startIntPt;
SurfSurfIntPoint* endIntPt;
std::shared_ptr <Curve2d> pCurve1;
std::shared_ptr <Curve2d> pCurve2;
//SurfSurfIntType left_int_type[2]; // Only used for mesh surface intersections (otherwise the single int_type above is sufficient).
//SurfSurfIntType right_int_type[2]; // Set to int_unknown if not used.
// 交线左边的surf patch与另一surf的内外关系
SurfSurfRelation leftSurfRel[2];
// 交线右边的surf patch与另一surf的内外关系
SurfSurfRelation rightSurfRel[2];
// The number of values in the array split_param.
int nSplit;
// The terminator point at the start of the curve.
double* splitParams;
short fuzzy; // add ???????
// Supports tolerant modeling. Role: The value is used to record the tolerance value of the intersection.It is defaulted to SPAresabs.
double tol;
};