#ifndef NURB_H #define NURB_H struct NurbSurface; typedef struct Point3Struct { /* 3d point */ double x, y, z; } Point3, Vector3; typedef struct Point4Struct { double x, y, z, w; } Point4; typedef Point4 Vector4; typedef struct SurfSample { Point3 point, normal; /* Point on surface, normal at that point */ double normLen; /* Used for normalizing normals */ double u, v; /* Parameters, e.g., used for texture mapping. */ /* Note the parameter's range is determined by the surface's knot vector, * i.e., u goes from kvU[orderU-1] to kvU[numU], and likewise for v */ } SurfSample; class Nurb { protected: NurbSurface *nurbSurface; short complexity; public: Nurb(void); Nurb(NurbSurface *); void attachNurbSurface(NurbSurface *); void setComplexity(short compl); short getComplexity(); Point4 getControlPoint(short u, short v); void setControlPoint(short u, short v, Point4 pt); void evaluateUV(double u, double v, Point3 &pt, Point3 &norm); short getNumU(); short getNumV(); short getOrderU(); short getOrderV(); const double *getKnotU(); const double *getKnotV(); void drawEvaluation(); SurfSample **gridEvaluation(); virtual void drawTriangle(const SurfSample *, const SurfSample *, const SurfSample *); }; extern "C" { extern NurbSurface **readObj(char *filename); } #endif