Entity Extrema

From DocR23

Jump to: navigation, search
Entity Extrema

Many applications require finding an extreme position of an ENTITY. For instance, to annotate an ACIS model with dimensions or text the extreme positions in specified directions might be required to determine where a label is to be placed. ACIS provides functionality to find extreme positions of entities.

Contents

Finding an Extreme Position of an ENTITY

The ACIS extrema function api_entity_extrema finds an extreme position and the corresponding extreme ENTITY in a specified direction. Where there is ambiguity because there is more than one entity in the specified direction, the user can specify (optionally) a second and third direction in order to assist the extrema function in determining a unique extremum.

Referring to the figure, the user specifies the direction V1 in which an extreme position is to be found. The possible extreme positions lie in an extreme plane H satisfying the following properties:

  • the plane normal direction is equal to V1,
  • the plane contains a point of the ENTITY, and
  • there are no points of the ENTITY to one side of the plane.

It is possible that there is more than one position of the given ENTITY that lies in the extreme plane. For instance, the model in the figure has extreme positions on both a spherical face and a planar face.

If the user does not specify a second extrema direction, then api_entity_extrema can return any extreme position in the first direction. If the user specifies a second direction V2, then the API will select an extreme position (from among the entities that have extreme positions in the extreme plane) that is extreme in the second direction. The position returned will lie on the line L in the extreme plane that has normal direction equal to the projection of V2 into the extreme plane. For instance, for the model shown in the figure, the vertices marked in blue and red, and the linear edge between the two vertices, all contain extreme positions for V1 and V2. It would be valid for the API to return either vertex or any position on the line.

Similarly, it is possible that more than one position of the given ENTITY lies in the extreme line L. If the user does not specify a third extrema direction, then api_entity_extrema will return any extreme position (of V1 and V2) and a corresponding extreme entity that contains that position. If the user specifies a third direction V3, then the API will select an extreme position, from among the entities that have extreme positions in the extreme line, that is also extreme in the third direction. For instance, for the model shown in the figure, giving a third direction V3 will ensure that the blue vertex is returned.

Note: It is not necessary for V1, V2 and V3 to be perpendicular. The user should carefully note the limitations described below.


Scheme Example

The example shows how to find extreme positions and how a second and third extreme direction can be specified to choose between extrema when there is an ambiguity.

; entity:extrema
; create topology to illustrate command.
(view:axes)
(define bdy (solid:block 0 0 0 50 50 10))
(define cyl (solid:cylinder 10 10 10 10 10 30 5))
(define sph (solid:sphere 10 10 30 5))
(define blk (solid:block 30 30 10 40 40 35))
(bool:unite bdy cyl sph blk)
; in this example we find extreme positions in the z axis direction (note that the extrema lie in the z = 35 plane)
(entity:extrema bdy (gvector 0 0 1))
; we find an extrema on the spherical face; returns a list containing the sphere entity, extreme position and sphere surface parameters
;(#[entity 5 1] #[ position 10 10 35 ] 1.5707963267949 -3.14159265358979)
; there are other extreme positions on other entities; choose a second direction
(entity:extrema bdy (gvector 0 0 1) (gvector 0 1 0))
; finds an extreme position at a vertex of the highest planar face; 
; (#[entity 6 1] #[ position 40 40 35 ])
; choosing a third direction specifies an extrema located at a different vertex
(entity:extrema bdy (gvector 0 0 1) (gvector 0 1 0) (gvector -1 0 0))
; (#[entity 7 1] #[ position 30 40 35 ])

Limitations

When more than one direction is given, the extension is not designed to find an extreme position that is extreme in both directions. For instance, consider a spline face with more than one interior point that is extreme in the first direction (see the Scheme example below). In this case, only a single extreme position is found and the second direction will have no effect. If, however, the face has extreme positions on each of two of its edges, then the extension will return an extreme position on the edge that is also extreme in the second direction.

Scheme Example Showing Limitation

In the example below a FACE has more than one extreme position in the given extreme direction. The specification of a second direction has no effect because of a limitation of the API (described above).

; Limitation of the extension
(define wiggle (solid:wiggle 40 40 40 2 2 2 2))
; in this example there are four extreme positions on the wiggle surface in z axis direction
(entity:extrema wiggle (gvector 0 0 1))
; (#[entity 9 1] #[ position -14.4181230750501 14.4181230750502 24.1902624070314 ] 6.66666662208254 33.3333333779175)
; a limitation of this extension is that, generally, we only compute one extrema for each entity
; specifying additional directions will not find any of the other extreme positions
(entity:extrema wiggle (gvector 0 0 1) (gvector 0 1 0))
; we obtain the same result as before
; (#[entity 9 1] #[ position -14.4181230750501 14.4181230750502 24.1902624070314 ] 6.66666662208254 33.3333333779175)

Implementation

See Also

Personal tools