00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef RU_ROTOSPLINE_H
00021 #define RU_ROTOSPLINE_H
00022
00023 #include "RU_API.h"
00024 #include <UT/UT_PtrArray.h>
00025
00026 class RU_RotoPoint;
00027 class GU_Detail;
00028 class UT_Vector2Array;
00029
00030 enum RU_RotoFill
00031 {
00032 ROTO_FILL_OPEN = 0,
00033 ROTO_FILL_CLOSED,
00034 ROTO_FILL_HOLLOW
00035 };
00036
00037 enum RU_RotoType
00038 {
00039 ROTO_TYPE_POLYGON = 0,
00040 ROTO_TYPE_BEZIER = 1,
00041 ROTO_TYPE_NURBS = 2
00042 };
00043
00044 class RU_API RU_RotoSpline
00045 {
00046 public:
00047 RU_RotoSpline(RU_RotoType curvetype, RU_RotoFill type,
00048 float detail =0.5f, float aspect = 1.0f);
00049 ~RU_RotoSpline();
00050
00051 int entries() const { return myPoints.entries(); }
00052 RU_RotoPoint *getPoint(int i) { return myPoints(i); }
00053 RU_RotoPoint *getPointByIndex(float index);
00054 void addPoint(RU_RotoPoint *point);
00055
00056 RU_RotoFill getFillType() const { return myFillType; }
00057
00058
00059
00060 GU_Detail *build(GU_Detail *rawcurve = 0);
00061 GU_Detail *buildFeather(float basewidth = 0.5F, GU_Detail *rawcurve = 0);
00062
00063 static void buildFreehand(const UT_Vector2Array &ipoints,
00064 UT_Vector2Array &points,
00065 UT_Vector2Array &slopes1,
00066 UT_Vector2Array &slopes2,
00067 float tolerance,bool isbezier, bool close);
00068
00069
00070
00071 void buildRawCurve(GU_Detail &, bool feather=false);
00072
00073
00074 private:
00075 UT_PtrArray<RU_RotoPoint *> myPoints;
00076 RU_RotoFill myFillType;
00077 float myAspect;
00078 float myDetail;
00079 RU_RotoType myCurveType;
00080 };
00081
00082
00083 class RU_API RU_RotoPoint
00084 {
00085 public:
00086 RU_RotoPoint(float index, float u, float v, float w,
00087 float u1 =0.0F, float v1 = 0.0F,
00088 float u2 = 0.0F, float v2 = 0.0F,
00089 float feather = 0.0F)
00090 : myU(u), myV(v), myThickness(w),
00091 mySlopeU1(u1), mySlopeU2(u2), mySlopeV1(v1), mySlopeV2(v2),
00092 myIndex(index), myFeatherWidth(feather) {}
00093
00094 float myU, myV;
00095 float myThickness;
00096 float mySlopeU1, mySlopeU2, mySlopeV1, mySlopeV2;
00097 float myIndex;
00098 float myFeatherWidth;
00099 };
00100
00101
00102
00103 #endif