maxscript/foundation/3dmath.h File Reference
 
 
 
maxscript/foundation/3dmath.h File Reference
#include "../ScripterExport.h"
#include "../kernel/value.h"
#include "../../quat.h"
#include "../../ipoint3.h"
#include "../macros/define_implementations.h"
#include "..\protocols\vector.inl"
#include "..\protocols\quat.inl"
#include "..\protocols\matrix.inl"
#include "..\protocols\box.inl"

Classes

class   ConstPoint3Value

Defines

#define  is_point3(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Point3Value))
#define  is_ray(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(RayValue))
#define  is_quat(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(QuatValue))
#define  is_angaxis(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(AngAxisValue))
#define  is_eulerangles(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(EulerAnglesValue))
#define  is_matrix3(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Matrix3Value))
#define  is_point2(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Point2Value))
#define  is_point4(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Point4Value))
#define  is_box2(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Box2Value))

Functions

ScripterExport void  _QuatToEuler (Quat &q, float *ang)
ScripterExport void  _EulerToQuat (float *ang, Quat &q)
  applyable_class_debug_ok (Point3Value) class Point3Value
IPoint3  to_ipoint3 (Value *val)
  applyable_class_debug_ok (RayValue) class RayValue
  applyable_class_debug_ok (QuatValue) class QuatValue
  applyable_class_debug_ok (AngAxisValue) class AngAxisValue
  applyable_class_debug_ok (EulerAnglesValue) class EulerAnglesValue
  applyable_class_debug_ok (Matrix3Value) class Matrix3Value
  applyable_class_debug_ok (Point2Value) class Point2Value
IPoint2  to_ipoint2 (Value *val)
  applyable_class_debug_ok (Point4Value) class Point4Value
  applyable_class_debug_ok (Box2Value) class Box2Value

Define Documentation

#define is_point3 (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Point3Value))
#define is_ray (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(RayValue))
#define is_quat (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(QuatValue))
#define is_angaxis (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(AngAxisValue))
#define is_eulerangles (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(EulerAnglesValue))
#define is_matrix3 (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Matrix3Value))
#define is_point2 (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Point2Value))
#define is_point4 (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Point4Value))
#define is_box2 (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Box2Value))

Function Documentation

ScripterExport void _QuatToEuler ( Quat q,
float *  ang 
)
ScripterExport void _EulerToQuat ( float *  ang,
Quat q 
)
applyable_class_debug_ok ( Point3Value  )

Define an equal operator (i.e. '==') for maxscript visible values.

Define a NOT equal operator (i.e. '!=') for maxscript visible values.

                  : public Value
{
public:
        Point3          p;
#pragma push_macro("new")
#undef new
        ENABLE_STACK_ALLOCATE(Point3Value);
#pragma pop_macro("new")
        ScripterExport Point3Value(Point3 init_point);
        ScripterExport Point3Value(float x, float y, float z);
        ScripterExport Point3Value(Value* x, Value* y, Value* z);

        classof_methods(Point3Value, Value);
        void            collect();
        ScripterExport void             sprin1(CharStream* s);
#       define          is_point3(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Point3Value))

        static Value* make(Value**arg_list, int count);

        /* operations */

#include "../macros/define_implementations.h"
#       include "..\protocols\vector.inl"
        use_generic( coerce,    "coerce");
        use_generic( copy,      "copy");
        use_generic( get,               "get");
        use_generic( put,               "put");

        /* built-in property accessors */

        def_property( x );
        def_property( y );
        def_property( z );

        Point3          to_point3() { return p; }
        AColor          to_acolor() { return AColor(p.x / 255.0f, p.y / 255.0f, p.z / 255.0f); }
        Point2          to_point2() { return Point2 (p.x, p.y); }
        ScripterExport void             to_fpvalue(FPValue& v);
        COLORREF        to_colorref() { return RGB((int)p.x, (int)p.y, (int)p.z); }

        // scene I/O 
        IOResult Save(ISave* isave);
        static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
IPoint3 to_ipoint3 ( Value val ) [inline]
                                       { 
        Point3 p = val->to_point3(); 
        return IPoint3((int)p.x, (int)p.y, (int)p.z); }
applyable_class_debug_ok ( RayValue  )
               : public Value
{
public:
        Ray                     r;
#pragma push_macro("new")
#undef new
        ENABLE_STACK_ALLOCATE(RayValue);
#pragma pop_macro("new")
        ScripterExport RayValue(Point3 init_origin, Point3 init_dir);
        ScripterExport RayValue(Ray init_ray);

        classof_methods(RayValue, Value);
        void            collect();
        ScripterExport void sprin1(CharStream* s);

        /* operations */

        use_generic( copy,      "copy");

        /* built-in property accessors */

        def_property( pos );
        def_property_alias( position, pos );
        def_property( dir );

        Ray                     to_ray() { return r; }
        ScripterExport void             to_fpvalue(FPValue& v);
#       define          is_ray(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(RayValue))

        // scene I/O 
        IOResult Save(ISave* isave);
        static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
applyable_class_debug_ok ( QuatValue  )

Define an equal operator (i.e. '==') for maxscript visible values.

Define a NOT equal operator (i.e. '!=') for maxscript visible values.

                : public Value
{
public:
        Quat            q;
#pragma push_macro("new")
#undef new
        ENABLE_STACK_ALLOCATE(QuatValue);
#pragma pop_macro("new")
        ScripterExport QuatValue(const Quat& init_quat);
        ScripterExport QuatValue(float w, float x, float y, float z);
        ScripterExport QuatValue(Value* w, Value* x, Value* y, Value* z);
        ScripterExport QuatValue(Value* val);
        ScripterExport QuatValue(AngAxis& aa);
        ScripterExport QuatValue(float* angles);
        ScripterExport QuatValue(Matrix3& m);

        classof_methods(QuatValue, Value);
#       define          is_quat(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(QuatValue))
        void            collect();
        ScripterExport void sprin1(CharStream* s);

        /* operations */

#include "../macros/define_implementations.h"
#       include "..\protocols\quat.inl"
        use_generic( copy,      "copy");

        /* built-in property accessors */

        def_property( w );
        def_property( x );
        def_property( y );
        def_property( z );
        def_property( angle );
        def_property( axis );

        Quat            to_quat() { return q; }
        AngAxis         to_angaxis() { return AngAxis(q); }
        ScripterExport void             to_fpvalue(FPValue& v);

        // scene I/O 
        IOResult Save(ISave* isave);
        static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
applyable_class_debug_ok ( AngAxisValue  )

Define an equal operator (i.e. '==') for maxscript visible values.

Define a NOT equal operator (i.e. '!=') for maxscript visible values.

                   : public Value
{
public:
        AngAxis         aa;
#pragma push_macro("new")
#undef new
        ENABLE_STACK_ALLOCATE(AngAxisValue);
#pragma pop_macro("new")
        ScripterExport AngAxisValue(const AngAxis& iaa);
        ScripterExport AngAxisValue(const Quat& q);
        ScripterExport AngAxisValue(const Matrix3& m);
        ScripterExport AngAxisValue(float* angles);
        ScripterExport AngAxisValue(float angle, Point3 axis);
        ScripterExport AngAxisValue(Value*);
        ScripterExport AngAxisValue(Value* angle, Value* axis);

        classof_methods(AngAxisValue, Value);
#       define          is_angaxis(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(AngAxisValue))
        void            collect();
        ScripterExport void sprin1(CharStream* s);

        /* operations */

#include "../macros/define_implementations.h"

        use_generic( coerce,    "coerce" );
        use_generic( eq,                "=");
        use_generic( ne,                "!=");
        use_generic( random,    "random");
        use_generic( copy,              "copy");

        /* built-in property accessors */

        def_property( angle );
        def_property( axis );
        def_property( numrevs );

        AngAxis         to_angaxis() { return aa; }
        Quat            to_quat() { return Quat(aa); }
        ScripterExport void             to_fpvalue(FPValue& v);

        // scene I/O 
        IOResult Save(ISave* isave);
        static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
applyable_class_debug_ok ( EulerAnglesValue  )

Define an equal operator (i.e. '==') for maxscript visible values.

Define a NOT equal operator (i.e. '!=') for maxscript visible values.

                       : public Value
{
public:
        float           angles[3];
#pragma push_macro("new")
#undef new
        ENABLE_STACK_ALLOCATE(EulerAnglesValue);
#pragma pop_macro("new")
        ScripterExport EulerAnglesValue(float ax, float ay, float az);
        ScripterExport EulerAnglesValue(const Quat&);
        ScripterExport EulerAnglesValue(const Matrix3&);
        ScripterExport EulerAnglesValue(const AngAxis&);

        classof_methods(EulerAnglesValue, Value);
#       define          is_eulerangles(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(EulerAnglesValue))
        void    collect();
        ScripterExport void sprin1(CharStream* s);

        /* operations */

#include "../macros/define_implementations.h"

        use_generic( coerce,    "coerce" );
        use_generic( eq,                "=");
        use_generic( ne,                "!=");
        use_generic( random,    "random");
        use_generic( copy,              "copy");

        /* built-in property accessors */

        def_property( x );
        def_property( y );
        def_property( z );
        def_property( x_rotation );
        def_property( y_rotation );
        def_property( z_rotation );

        AngAxis         to_angaxis() { return AngAxis(to_quat()); }
        Quat            to_quat() { Quat q; _EulerToQuat(angles, q); return Quat(q); }
        ScripterExport void             to_fpvalue(FPValue& v);
        float*          to_eulerangles() { return angles; }

        // scene I/O 
        IOResult Save(ISave* isave);
        static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
applyable_class_debug_ok ( Matrix3Value  )

Define an equal operator (i.e. '==') for maxscript visible values.

Define a NOT equal operator (i.e. '!=') for maxscript visible values.

                   : public Value
{
public:
        Matrix3         m;
#pragma push_macro("new")
#undef new
        ENABLE_STACK_ALLOCATE(Matrix3Value);
#pragma pop_macro("new")
        ScripterExport Matrix3Value(int i);
        ScripterExport Matrix3Value(const Matrix3& im);
        ScripterExport Matrix3Value(const Quat& q);
        ScripterExport Matrix3Value(const AngAxis& aa);
        ScripterExport Matrix3Value(float* angles);
        ScripterExport Matrix3Value(const Point3& row0, const Point3& row1, const Point3& row2, const Point3& row3);

        classof_methods(Matrix3Value, Value);
        void            collect();
        ScripterExport void sprin1(CharStream* s);
#       define          is_matrix3(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Matrix3Value))

        /* operations */

#include "../macros/define_implementations.h"
#       include "..\protocols\matrix.inl"
        use_generic( copy,              "copy");

        /* built-in property accessors */

        def_property( row1 );
        def_property( row2 );
        def_property( row3 );
        def_property( row4 );
        def_property( translation );
        def_property( pos );
        def_property( rotation );
        def_property( scale );

        use_generic( get,               "get");
        use_generic( put,               "put");


        Value*          get_property(Value** arg_list, int count);
        Value*          set_property(Value** arg_list, int count);

        Matrix3&        to_matrix3() { return m; }
        Quat            to_quat() { return Quat(m); }
        ScripterExport void             to_fpvalue(FPValue& v);

        // scene I/O 
        IOResult Save(ISave* isave);
        static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
applyable_class_debug_ok ( Point2Value  )

Define an equal operator (i.e. '==') for maxscript visible values.

Define a NOT equal operator (i.e. '!=') for maxscript visible values.

                  : public Value
{
public:
        Point2          p;
#pragma push_macro("new")
#undef new
        ENABLE_STACK_ALLOCATE(Point2Value);
#pragma pop_macro("new")
        ScripterExport Point2Value(Point2 ipoint);
        ScripterExport Point2Value(POINT ipoint);
        ScripterExport Point2Value(float x, float y);
        ScripterExport Point2Value(Value* x, Value* y);

        classof_methods(Point2Value, Value);
        void            collect();
        ScripterExport void sprin1(CharStream* s);
#       define          is_point2(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Point2Value))

        static Value* make(Value**arg_list, int count);

        /* operations */

#include "../macros/define_implementations.h"
        use_generic( plus,              "+" );
        use_generic( minus,             "-" );
        use_generic( times,             "*" );
        use_generic( div,               "/" );
        use_generic( uminus,    "u-");
        use_generic( eq,                "=");
        use_generic( ne,                "!=");
        use_generic( random,    "random");
        use_generic( length,    "length");
        use_generic( distance,  "distance");
        use_generic( normalize, "normalize");
        use_generic( copy,              "copy");
        use_generic( get,               "get");
        use_generic( put,               "put");

        /* built-in property accessors */

        def_property( x );
        def_property( y );

        Point2          to_point2() { return p; }
        ScripterExport void             to_fpvalue(FPValue& v);

        // scene I/O 
        IOResult Save(ISave* isave);
        static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
IPoint2 to_ipoint2 ( Value val ) [inline]
                                       { 
        Point2 p = val->to_point2(); 
        return IPoint2((int)p.x, (int)p.y); }
applyable_class_debug_ok ( Point4Value  )

Define an equal operator (i.e. '==') for maxscript visible values.

Define a NOT equal operator (i.e. '!=') for maxscript visible values.

                  : public Value
{
public:
        Point4          p;
#pragma push_macro("new")
#undef new
        ENABLE_STACK_ALLOCATE(Point4Value);
#pragma pop_macro("new")
        ScripterExport Point4Value(Point4 init_point);
        ScripterExport Point4Value(float x, float y, float z, float w);
        ScripterExport Point4Value(Value* x, Value* y, Value* z, Value* w);

        classof_methods(Point4Value, Value);
        void            collect();
        ScripterExport void             sprin1(CharStream* s);
#       define          is_point4(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Point4Value))

        static Value* make(Value**arg_list, int count);

        /* operations */

#include "../macros/define_implementations.h"
#       include "..\protocols\vector.inl"
        use_generic( coerce,    "coerce");
        use_generic( copy,      "copy");
        use_generic( get,               "get");
        use_generic( put,               "put");

        /* built-in property accessors */

        def_property( x );
        def_property( y );
        def_property( z );
        def_property( w );

        Point4          to_point4() { return p; }
        Point3          to_point3() { return Point3 (p.x, p.y, p.z); }
        AColor          to_acolor() { return AColor(p.x, p.y, p.z, p.w); }
        Point2          to_point2() { return Point2 (p.x, p.y); }
        ScripterExport void             to_fpvalue(FPValue& v);
        COLORREF        to_colorref() { return RGB((int)(p.x*255.f), (int)(p.y*255.f), (int)(p.z*255.f)); }

        // scene I/O 
        IOResult Save(ISave* isave);
        static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
applyable_class_debug_ok ( Box2Value  )

Define an equal operator (i.e. '==') for maxscript visible values.

Define a NOT equal operator (i.e. '!=') for maxscript visible values.

                : public Value
{

public:
        Box2 b;

        ScripterExport  Box2Value();
        ScripterExport  Box2Value(Box2 box);    
        ScripterExport  Box2Value(RECT rect);
        ScripterExport  Box2Value(IPoint2 ul, IPoint2 lr);
        ScripterExport  Box2Value(int x, int y, int w, int h);
        ScripterExport  Box2Value(Value* x, Value* y, Value* w, Value* h);

        classof_methods(Box2Value, Value);
        void                    collect();
        ScripterExport  void    sprin1(CharStream* s);  
#       define                  is_box2(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Box2Value))

        static Value*   make(Value**arg_list, int count);

        /* operations */

#include "../macros/define_implementations.h"   
#       include "..\protocols\box.inl"

        /* built-in property accessors */

        def_property( x );
        def_property( y );
        def_property( w );
        def_property( h );
        def_property( left );
        def_property( top );
        def_property( right );
        def_property( bottom );
        def_property( center );

        Box2&           to_box2() { return b; }
};