00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GEO_Point_H__
00021 #define __GEO_Point_H__
00022
00023 #include "GEO_API.h"
00024 #include <UT/UT_SmallObject.h>
00025 #include <UT/UT_Vector4.h>
00026 #include <GB/GB_Element.h>
00027 #include <GB/GB_Attribute.h>
00028
00029 class GEO_Primitive;
00030 class GB_FloatOffsets;
00031
00032 class GEO_API GEO_Point : public GB_Element, public GB_AttributeElem,
00033 public UT_SmallObject<GEO_Point,
00034 UT_SMALLOBJECT_CLEANPAGES_DEFAULT,
00035 UT_SMALLOBJECT_PAGESIZE_DEFAULT,
00036 UT_SMALLOBJECT_THREADSAFE_ON>
00037 {
00038 public:
00039
00040
00041
00042 GEO_Point()
00043 { myPos.assign(0.0F,0.0F,0.0F,1.0F); }
00044 GEO_Point(const UT_Vector4 &P, GB_AttributeData &adata)
00045 { myPos = P; getAttrib().swapData(adata); }
00046 virtual ~GEO_Point();
00047
00048
00049 virtual int isPrimary(void) const;
00050
00051
00052
00053 void SYS_DEPRECATED copyPoint(const GEO_Point *src, int asize);
00054
00055 void SYS_DEPRECATED copyAttributeData(const GEO_Point *src, int asize);
00056
00057 void copyPoint(const GEO_Point &src,
00058 const GB_AttributeDict &dict)
00059 {
00060 myPos = src.myPos;
00061 copyAttributeValues(src, dict);
00062 }
00063
00064
00065 void copyPoint(const GEO_Point &src,
00066 const GB_AttributeDict &src_dict,
00067 const GB_AttributeDict &dest_dict);
00068
00069 UT_Vector4 &getPos() { return myPos; }
00070 const UT_Vector4 &getPos() const { return myPos; }
00071 void setPos(const UT_Vector4 &p)
00072 { myPos = p; }
00073 void setPos(const UT_Vector3 &p, float w=1)
00074 { myPos.assign(p.x(), p.y(), p.z(), w); }
00075 void setPos(fpreal x, fpreal y, fpreal z, fpreal w=1)
00076 { myPos.assign(x, y, z, w); }
00077
00078
00079 void homogenize (void) { myPos.homogenize(); }
00080 void dehomogenize(void) { myPos.dehomogenize(); }
00081 void SYS_DEPRECATED homogenizeWAttrib(const GB_FloatOffsets &foffsets);
00082 void SYS_DEPRECATED dehomogenizeWAttrib(const GB_FloatOffsets &foffsets);
00083
00084
00085 int saveASCII(ostream &os) const;
00086 int saveBinary(ostream &os) const;
00087 bool load(UT_IStream &is);
00088
00089 private:
00090 UT_Vector4 myPos;
00091 };
00092
00093 #endif