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