Tangency
Tangency is a geometric constraint that positions a pair of curves so that they would be tangent in one point. Table 1 shows supported tangency curve pairs.
Table 1 - Curve pairs supported by tangency constraint
Line |
Circle |
Ellipse |
Spline |
Parametric curve |
|
|---|---|---|---|---|---|
Line |
\(\surd\) |
\(\surd\) |
\(\surd\) |
\(\surd\) |
|
Circle |
\(\surd\) |
\(\surd\) |
\(\surd\) |
\(\surd\) |
\(\surd\) |
Ellipse |
\(\surd\) |
\(\surd\) |
\(\surd\) |
||
Spline |
\(\surd\) |
\(\surd\) |
\(\surd\) |
\(\surd\) |
|
Parametric curve |
\(\surd\) |
\(\surd\) |
Selecting the tangency variant. Fig. 1 shows two tangency examples for circle-circle and circle-line pairs. Dashed lines indicate the circles with alternate tangency variants. The figure clearly demonstrates that any tangency constraint has two solutions. For instance, circles may be tangent while remaining one outside or inside another; in other example in Fig. 29.10.1. the right side shows that there are two mutual positioning variants for circle and line tangency: the circle can be “at the left” or “at the right” from the line.
Fig. 1
The GCE geometric solver selects one of two tangency variants based on proximity to the preferred solution. In fact, the tangent objects themselves indicate which of the two mutual positioning variants would be chosen. When the constraint is formed, the solver “remembers” the current mutual position of the objects and saves it when the sketch geometry would be further modified (see Item Mutual Object Positioning).
Auxiliary tangency parameters. The above approach to the tangency variant selection is sufficient if you are dealing with analytical curves (lines, circles, ellipses) only. For a curve with arbitrarily shapes, such as a spline or a parametric curve, it is required to specify the tangency point location along the curve.
Fig. 2 shows an example, where the mutual position of a line and a spline is already chosen (the curves are co-directional in the tangency point). However, this variant also has its variants with other possible tangency point locations. The t1 and t2 variables taken in parametric spline domain indicate two alternate tangency points for a spline and a segment with one fixed end.
Fig. 2
To specify the locations of the tangency points on splines or parametric curves, it is required to add auxiliary variables specifying suggested tangency point in the parametric domain of the curve. The most common implementation of this process in end-user application is as follows. The user selects the tangency object with a pointer, and pointer coordinates are considered as an approximation of the suggested tangency point. If pointer coordinates are known, it is possible to approximately assess the tangency parameter (the parameter of the closest point on the curve).
Creating a tangency constraint. A tangency constraint is defined by calling the following method:
constraint_item GCE_AddTangent(GCE_system gSys, geom_item g[2], var_item tPar[2])
The method input parameters are:
gSys is the parametric sketch constraint system;
g[2] are the descriptors of two curves;
tPar[2] are the variable descriptors, these are auxiliary tangency parameters for the first curve and the second curve.
The function returns a description of a new tangency constraint created for the given pair of curves. The values of auxiliary parameters tPar[0] and tPar[1] are taken into account only if the first or second curve correspondingly is a spline or a parametric curve. GCE_NULL_V empty descriptor should be passed for analytical curves (line/circle/ellipse). For example, if both curves are analytical, then you can pass {GCE_NULL_V,GCE_NULL_V} array to tPar. If the tangency is defined for a spline or a parametric curve, then an auxiliary variable is created for the constraint by calling the GCE_AddVariable method. The initial value of the variable would indicate the suggested tangency point in the parametric curve domain. It should be noted that any variable, as well as geometric objects, is a subject of calculations, so its value would be updated in all calculation requests of the solver (GCE_Evaluate, see Item Calculating the Constraint System), i.e. the solver would actually track the current value of the tangency parameter.
If tPar[idx] = GCE_NULL_V for a spline or for parametric curve, then the tangency point location would be determined automatically based on proximity to the initial position of objects.