This reference page is linked to from the following overview
topics: Snapping.
#include <osnaphit.h>
Class Description
- See also:
- Class Osnap, The
Advanced Topics section on Snapping..
- Description:
- This is a class to hold a list of object space points for
highlighting the geometry associated with a hit. One oddity of this
class is that you need to allocate one point more than the number
of points you actually need. This additional storage is used for
clipping against the viewport at display time. For example the
"endpoint" snap would alocate a three-point hitmesh to highlight
the edge which was hit (See the example below) .
The class has data members for the number of points and a pointer
to the actual Point3 list.
In practice, developers need only use the first two methods shown
below.
Constructor & Destructor Documentation
- Parameters:
- int n
The number of points to allocate.
Member Function Documentation
Point3 operator[] |
( |
int |
i |
) |
[inline] |
- Parameters:
- int i
Specifies the point to return.
int getNumVerts |
( |
void |
|
) |
[inline] |
CoreExport void setNumVerts |
( |
int |
n |
) |
|
- Parameters:
- int n
The number of points to allocate.
void setVert |
( |
int |
i, |
|
|
const Point3 & |
xyz |
|
) |
|
[inline] |
- Parameters:
- int i
The vertex to set.
const Point3
&xyz
The value to set.
In practice, developers need only use the two previous methods.
The following code segment from the mesh snap exemplifies their
use.
if(GetActive(EDGE_SUB))
{
HitMesh *hitmesh = new HitMesh(3);
hitmesh->setVert(0, from);
hitmesh->setVert(1, to);
float dap = Length(cursor - sf2);
assert(Length(st2 - sf2)>=0.0f);
float pct = (float)sqrt(fabs(dap*dap - distance*distance)) / Length(st2 - sf2);
Point3 cand;
float pctout = gw->interpWorld(&xyz[0],&xyz[1],pct,&cand);
theman->RecordHit(new EdgeHit(cand, this, EDGE_SUB, hitmesh, ifrom, ito, pct));
}
Point3& getVert |
( |
int |
i |
) |
[inline] |
Point3* getVertPtr |
( |
|
) |
[inline] |