Blender V2.61 - r43446

BKE_curve.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 #ifndef BKE_CURVE_H
00028 #define BKE_CURVE_H
00029 
00036 struct BevList;
00037 struct BezTriple;
00038 struct Curve;
00039 struct EditNurb;
00040 struct ListBase;
00041 struct ListBase;
00042 struct Nurb;
00043 struct Object;
00044 struct Scene;
00045 
00046 #define KNOTSU(nu)      ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_NURB_CYCLIC) ? ((nu)->orderu-1) : 0) )
00047 #define KNOTSV(nu)      ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_NURB_CYCLIC) ? ((nu)->orderv-1) : 0) )
00048 
00049 /* Non cyclic nurbs have 1 less segment */
00050 #define SEGMENTSU(nu)       ( ((nu)->flagu & CU_NURB_CYCLIC) ? (nu)->pntsu : (nu)->pntsu-1 )
00051 #define SEGMENTSV(nu)       ( ((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 )
00052 
00053 #define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1)
00054 #define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1!=0.0f || (cu)->ext2!=0.0f) ? 1:0)
00055 
00056 
00057 void unlink_curve( struct Curve *cu);
00058 void free_curve_editNurb_keyIndex(struct EditNurb *editnurb);
00059 void free_curve_editNurb(struct Curve *cu);
00060 void free_curve( struct Curve *cu);
00061 void BKE_free_editfont(struct Curve *cu);
00062 struct Curve *add_curve(const char *name, int type);
00063 struct Curve *copy_curve( struct Curve *cu);
00064 void make_local_curve( struct Curve *cu);
00065 struct ListBase *curve_editnurbs(struct Curve *cu);
00066 short curve_type( struct Curve *cu);
00067 void test_curve_type( struct Object *ob);
00068 void update_curve_dimension( struct Curve *cu );
00069 void tex_space_curve( struct Curve *cu);
00070 int count_curveverts( struct ListBase *nurb);
00071 int count_curveverts_without_handles( struct ListBase *nurb);
00072 void freeNurb( struct Nurb *nu);
00073 void freeNurblist( struct ListBase *lb);
00074 struct Nurb *duplicateNurb( struct Nurb *nu);
00075 void duplicateNurblist( struct ListBase *lb1,  struct ListBase *lb2);
00076 void test2DNurb( struct Nurb *nu);
00077 void minmaxNurb( struct Nurb *nu, float *min, float *max);
00078 
00079 void nurbs_knot_calc_u(struct Nurb *nu);
00080 void nurbs_knot_calc_v(struct Nurb *nu);
00081 
00082 void makeNurbfaces(struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv);
00083 void makeNurbcurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride);
00084 void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride);
00085 float *make_orco_curve(struct Scene *scene, struct Object *ob);
00086 float *make_orco_surf( struct Object *ob);
00087 void makebevelcurve(struct Scene *scene, struct Object *ob,  struct ListBase *disp, int forRender);
00088 
00089 void makeBevelList( struct Object *ob);
00090 
00091 void calchandleNurb( struct BezTriple *bezt, struct BezTriple *prev,  struct BezTriple *next, int mode);
00092 void calchandlesNurb( struct Nurb *nu);
00093 void testhandlesNurb( struct Nurb *nu);
00094 void autocalchandlesNurb( struct Nurb *nu, int flag);
00095 void autocalchandlesNurb_all(ListBase *editnurb, int flag);
00096 void sethandlesNurb(ListBase *editnurb, short code);
00097 
00098 void switchdirectionNurb( struct Nurb *nu);
00099 
00100 void addNurbPoints(struct Nurb *nu, int number);
00101 void addNurbPointsBezier(struct Nurb *nu, int number);
00102 
00103 float (*curve_getVertexCos(struct Curve *cu, struct ListBase *lb, int *numVerts_r))[3];
00104 void curve_applyVertexCos(struct Curve *cu, struct ListBase *lb, float (*vertexCos)[3]);
00105 
00106 float (*curve_getKeyVertexCos(struct Curve *cu, struct ListBase *lb, float *key))[3];
00107 void curve_applyKeyVertexTilts(struct Curve *cu, struct ListBase *lb, float *key);
00108 
00109 /* nurb checks if they can be drawn, also clamp order func */
00110 int check_valid_nurb_u( struct Nurb *nu);
00111 int check_valid_nurb_v( struct Nurb *nu);
00112 
00113 int clamp_nurb_order_u( struct Nurb *nu);
00114 int clamp_nurb_order_v( struct Nurb *nu);
00115 
00116 ListBase *BKE_curve_nurbs(struct Curve *cu);
00117 
00118 int minmax_curve(struct Curve *cu, float min[3], float max[3]);
00119 int curve_center_median(struct Curve *cu, float cent[3]);
00120 int curve_center_bounds(struct Curve *cu, float cent[3]);
00121 void curve_translate(struct Curve *cu, float offset[3], int do_keys);
00122 void curve_delete_material_index(struct Curve *cu, int index);
00123 #endif
00124