2017-04-17 06:17:10 -06:00

163 lines
4.1 KiB
C++
Executable File

#ifndef LINUX
#pragma once
#endif
#ifndef _MPoint
#define _MPoint
//
// *****************************************************************************
//
// Copyright (C) 1997-2001 Alias|Wavefront Inc.
//
// These coded instructions, statements and computer programs contain
// unpublished information proprietary to Alias|Wavefront Inc. and are
// protected by Canadian and US federal copyright laws. They may not be
// disclosed to third parties or copied or duplicated, in whole or in part,
// without prior written consent of Alias|Wavefront Inc.
//
// Unpublished-rights reserved under the Copyright Laws of the United States.
//
// *****************************************************************************
//
// CLASS: MPoint
//
// *****************************************************************************
//
// CLASS DESCRIPTION (MPoint)
//
// This class provides an implementation of a point. Numerous convienence
// operators are provided to help with the manipulation of points. This
// includes operators that work with the MVector and MMatrix classes.
//
// *****************************************************************************
#if defined __cplusplus
// *****************************************************************************
// INCLUDED HEADER FILES
#include <maya/MTypes.h>
// *****************************************************************************
// DECLARATIONS
class MMatrix;
class MVector;
class MFloatVector;
#define MPoint_kTol 1.0e-10
// *****************************************************************************
// CLASS DECLARATION (MPoint)
/// implementation of a point
/**
This class implements the Maya representation of a point
*/
#ifdef _WIN32
#pragma warning(disable: 4522)
#endif // _WIN32
class OPENMAYA_EXPORT MPoint
{
public:
///
MPoint(); // defaults to 0,0,0,1
///
MPoint( const MPoint & srcpt );
///
MPoint( const MVector & src );
///
MPoint( const MFloatVector & src );
///
MPoint( double xx, double yy,
double zz = 0.0, double ww = 1.0 );
///
MPoint( const double[4] );
///
MPoint( const float[4] );
///
~MPoint();
///
MStatus get( double[4] ) const;
///
MStatus get( float[4] ) const;
///
MPoint & operator=( const MPoint & src );
///
double & operator()(unsigned i);
///
double operator()(unsigned i) const;
///
double & operator[](unsigned i);
///
double operator[](unsigned i) const;
///
MVector operator-( const MPoint & other ) const;
///
MPoint operator+( const MVector & other ) const;
///
MPoint operator-( const MVector & other ) const;
///
MPoint & operator+=( const MVector & vector );
///
MPoint & operator-=( const MVector & vector );
///
MPoint operator*(const double scale) const;
///
MPoint operator/(const double scale) const;
///
MPoint operator*(const MMatrix &) const;
///
MPoint & operator*=(const MMatrix &);
///
friend OPENMAYA_EXPORT MPoint operator*(const MMatrix &, const MPoint &);
///
bool operator==( const MPoint & other ) const;
///
bool operator!=( const MPoint & other ) const;
///
MPoint & cartesianize();
///
MPoint & rationalize();
///
MPoint & homogenize();
///
double distanceTo( const MPoint & other ) const;
///
bool isEquivalent( const MPoint & other,
double tolerance = MPoint_kTol) const;
///
friend OPENMAYA_EXPORT ostream& operator<<(ostream& os, const MPoint& p);
///
static const MPoint origin;
public:
/// the x component of the point
double x;
/// the y component of the point
double y;
/// the z component of the point
double z;
/// the w component of the point
double w;
protected:
// No protected members
private:
static const char* className();
};
#ifdef _WIN32
#pragma warning(default: 4522)
#endif // _WIN32
// *****************************************************************************
#endif /* __cplusplus */
#endif /* _MPoint */