3ds Max C++ API Reference
OsnapHit Class Reference

#include <osnaphit.h>

+ Inheritance diagram for OsnapHit:

Public Member Functions

CoreExport OsnapHit (Point3 p3, Osnap *s, int sub, HitMesh *m)
 
CoreExport OsnapHit (Point3 pt)
 
CoreExport OsnapHit (const OsnapHit &h)
 
virtual CoreExport OsnapHitoperator= (const OsnapHit &h)
 
virtual CoreExport ~OsnapHit ()
 
virtual CoreExport OsnapHitclone ()
 
void setscreendata (IPoint3 screen3, int len)
 
virtual CoreExport boolean display (ViewExp *vpt, TimeValue t, Point3 color, int markersize, boolean markers=TRUE, boolean hilite=TRUE)
 
CoreExport void erase (ViewExp *vpt, TimeValue t) const
 
CoreExport void GetViewportRect (TimeValue t, ViewExp *vpt, Rect *rect, int marksize) const
 
CoreExport Point3 GetHitpoint ()
 
CoreExport Point3 GetWorldHitpoint ()
 
CoreExport IPoint3 GetHitscreen ()
 
CoreExport int GetSubsnap ()
 
CoreExport POINT GetCursor ()
 
INodeGetNode ()
 
void Dump () const
 
CoreExport BOOL operator< (OsnapHit &hit)
 
CoreExport BOOL operator> (OsnapHit &hit)
 
void Update (TimeValue t)
 
CoreExport Point3 ReEvaluate (TimeValue t)
 
virtual bool IsWorldSpaceHit ()
 
- Public Member Functions inherited from BaseInterfaceServer
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
virtual UtilExport int NumInterfaces () const
 
virtual UtilExport BaseInterfaceGetInterfaceAt (int i) const
 
virtual UtilExport ~BaseInterfaceServer ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Friends

class OsnapManager
 
class Osnap
 
class TypedHit
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 
- Protected Attributes inherited from BaseInterfaceServer
Tab< BaseInterface * > interfaces
 

Detailed Description

See also
Class IOsnapManager, Class Osnap, Class HitMesh, Class Point3, Class IPoint3, The Advanced Topics section on Snapping.

Description:
This class encapsulates the data required to record a snapped point. Typically a plug-in creates instances of this class and records them with the OsnapManager. The manager is responsible for freeing the memory associated with recorded hits. All the methods of this class are implemented by the system. If a snap plugin needs to record additional data for its hits, it should derive from this class and provide a clone method which copies this additional data and calls the base classes clone method.

Constructor & Destructor Documentation

◆ OsnapHit() [1/3]

CoreExport OsnapHit ( Point3  p3,
Osnap s,
int  sub,
HitMesh m 
)
Remarks
Constructor. The data members are initialized to the values passed.
Parameters:
Point3 p3

The point that was hit in object space.

Osnap* s

Points to the Osnap instance which made this hit.

int sub

The sub-snap index which made this hit.

HitMesh *m

Points to the mesh used to hilite the topology that was hit.

◆ OsnapHit() [2/3]

◆ OsnapHit() [3/3]

CoreExport OsnapHit ( const OsnapHit h)
Remarks
Constructor. The data members are initialized from the OsnapHit passed.
Parameters:
const OsnapHit& h

The data members are copied from this OsnapHit.

◆ ~OsnapHit()

virtual CoreExport ~OsnapHit ( )
virtual
Remarks
Destructor. If a HitMesh was allocated it is deleted.

Member Function Documentation

◆ operator=()

virtual CoreExport OsnapHit& operator= ( const OsnapHit h)
virtual
Remarks
Assignment operator.
Parameters:
const OsnapHit& h

The OsnapHit to assign.

◆ clone()

virtual CoreExport OsnapHit* clone ( )
virtual
Remarks
Returns a pointer to a new instance of the OsnapHit class and initializes it with this instance. Developers deriving from this class should overide this method.

◆ setscreendata()

void setscreendata ( IPoint3  screen3,
int  len 
)
Remarks
This method is used internally. Sets the data members associated with screen hit data.
Parameters:
IPoint3 screen3

The hit location in screen space.

int len

The distance from the cursor.

◆ display()

virtual CoreExport boolean display ( ViewExp vpt,
TimeValue  t,
Point3  color,
int  markersize,
boolean  markers = TRUE,
boolean  hilite = TRUE 
)
virtual
Remarks
This display method is implemented by the system and used internally.
Parameters:
ViewExp *vpt

The viewport to display in.

TimeValue t

The current time.

Point3 color

The color to draw it in.

int markersize

The relative size of the icon.

boolean markers = TRUE

Controls whether or not the hit icon is drawn.

boolean hilite = TRUE

Controls whether or not the mesh part of the hit is drawn.

Reimplemented in TypedHit.

◆ erase()

CoreExport void erase ( ViewExp vpt,
TimeValue  t 
) const
Remarks
This method is not currently used.

◆ GetViewportRect()

CoreExport void GetViewportRect ( TimeValue  t,
ViewExp vpt,
Rect rect,
int  marksize 
) const
Remarks
Implemented by the system.

This method determines the damage rectangle for this hit.
Parameters:
TimeValue t

The time at which to compute the rectangle.

ViewExp *vpt

The viewport in which to compute the rectangle.

Rect *rect

Points to storage for the computed result.

int marksize

The size of the icon.

◆ GetHitpoint()

CoreExport Point3 GetHitpoint ( )
inline
Remarks
Returns the hit location in object space.
127 {return hitpoint;};

◆ GetWorldHitpoint()

CoreExport Point3 GetWorldHitpoint ( )
inline
Remarks
Returns the hit location in world space.
129 {return worldpoint;};

◆ GetHitscreen()

CoreExport IPoint3 GetHitscreen ( )
inline
Remarks
Returns the hit location in screen space. IPoint3.z is the depth in screen space.
132 {return m_hitscreen;};

◆ GetSubsnap()

CoreExport int GetSubsnap ( )
inline
Remarks
Returns the sub-snap index which made this hit.
134 {return subsnap;}

◆ GetCursor()

CoreExport POINT GetCursor ( )
inline
135 {return m_cursor;}

◆ GetNode()

INode* GetNode ( void  )
inline
Remarks
Returns a pointer to the node which got hit.
137 {return node;}

◆ Dump()

void Dump ( ) const
Remarks
This method is used internally for debugging and is not implemented for plug-in use.
Operators:

◆ operator<()

CoreExport BOOL operator< ( OsnapHit hit)
Remarks
This comparison operator is used in sorting.
Parameters:
OsnapHit& hit

The OsnapHit to compare.
Returns
TRUE if the distance from the cursor is less than hit; otherwise checks if the depth in Z space is less than hit: If so TRUE; otherwise FALSE.

◆ operator>()

CoreExport BOOL operator> ( OsnapHit hit)
Remarks
This comparison operator is used in sorting.
Parameters:
OsnapHit& hit

The OsnapHit to compare.
Returns
TRUE if the distance from the cursor is less than hit; otherwise checks if the depth in Z space is less than hit: If so TRUE; otherwise FALSE.

◆ Update()

void Update ( TimeValue  t)
Remarks
This method is not currently implemented.

◆ ReEvaluate()

CoreExport Point3 ReEvaluate ( TimeValue  t)
Remarks
Implemented by the System.

This method updates the internal data to reflect a change in time. For example, if a hit is recorded on the endpoint of a particular edge of a mesh, the node moving would invalidate the hit data and a call to this method would be required before using its data.
Parameters:
TimeValue t

The time at which to reevaluate it.
Returns
The updated point in world space.

◆ IsWorldSpaceHit()

virtual bool IsWorldSpaceHit ( )
inlinevirtual

Reimplemented in TypedHit.

178 {return false;}

Friends And Related Function Documentation

◆ OsnapManager

friend class OsnapManager
friend

◆ Osnap

friend class Osnap
friend

◆ TypedHit

friend class TypedHit
friend