diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-20 10:47:16 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-20 10:47:16 +0400 |
commit | 66f5ac408e168acecbc39ad671103697952d314c (patch) | |
tree | 9a451a792a4f1fc67f0803faa3f3650cf4108c1f /source/blender/blenlib/BLI_math_geom.h | |
parent | b5a2d7f15e2ae60d51c049e56346d058d7c5cb0f (diff) |
edit definitions to use const for non modified args, also correct incorrect definition for clip_line_plane().
Diffstat (limited to 'source/blender/blenlib/BLI_math_geom.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 3174c65beac..eb69ddc26eb 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -44,8 +44,8 @@ extern "C" { /********************************** Polygons *********************************/ -void cent_tri_v3(float r[3], float a[3], float b[3], float c[3]); -void cent_quad_v3(float r[3], float a[3], float b[3], float c[3], float d[3]); +void cent_tri_v3(float r[3], const float a[3], const float b[3], const float c[3]); +void cent_quad_v3(float r[3], const float a[3], const float b[3], const float c[3], const float d[3]); float normal_tri_v3(float r[3], const float a[3], const float b[3], const float c[3]); float normal_quad_v3(float r[3], const float a[3], const float b[3], const float c[3], const float d[3]); @@ -54,17 +54,17 @@ float area_tri_v2(const float a[2], const float b[2], const float c[2]); float area_tri_signed_v2(const float v1[2], const float v2[2], const float v3[2]); float area_tri_v3(const float a[3], const float b[3], const float c[3]); float area_quad_v3(const float a[3], const float b[3], const float c[3], const float d[3]); -float area_poly_v3(int nr, float verts[][3], float normal[3]); +float area_poly_v3(int nr, float verts[][3], const float normal[3]); /********************************* Distance **********************************/ -float dist_to_line_v2(float p[2], float l1[2], float l2[2]); -float dist_to_line_segment_v2(float p[2], float l1[2], float l2[2]); +float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2]); +float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]); -float dist_to_line_segment_v3(float p[3], float l1[3], float l2[3]); +float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v2(float r[2], const float p[2], const float l1[2], const float l2[2]); -void closest_to_line_segment_v3(float r[3], float p[3], float l1[3], float l2[3]); +void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3], const float l2[3]); /******************************* Intersection ********************************/ @@ -78,7 +78,7 @@ void closest_to_line_segment_v3(float r[3], float p[3], float l1[3], float l2[3] int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]); int isect_line_line_v2_short(const short a1[2], const short a2[2], const short b1[2], const short b2[2]); -int isect_seg_seg_v2_point(const float *v1, const float *v2, const float *v3, const float *v4, float vi[2]); +int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]); /* Returns the number of point of interests * 0 - lines are colinear @@ -92,51 +92,51 @@ int isect_line_line_strict_v3(float v1[3], float v2[3], float v3[3], float v4[3], float vi[3], float *lambda); /* line/ray triangle */ -int isect_line_tri_v3(float p1[3], float p2[3], - float v0[3], float v1[3], float v2[3], float *lambda, float *uv); -int isect_ray_tri_v3(float p1[3], float d[3], - float v0[3], float v1[3], float v2[3], float *lambda, float *uv); -int isect_ray_tri_threshold_v3(float p1[3], float d[3], - float v0[3], float v1[3], float v2[3], float *lambda, float *uv, float threshold); -int isect_ray_tri_epsilon_v3(float p1[3], float d[3], - float v0[3], float v1[3], float v2[3], float *lambda, float *uv, float epsilon); +int isect_line_tri_v3(const float p1[3], const float p2[3], + const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]); +int isect_ray_tri_v3(const float p1[3], const float d[3], + const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]); +int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], + const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float threshold); +int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], + const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float epsilon); /* point in polygon */ -int isect_point_quad_v2(float p[2], float a[2], float b[2], float c[2], float d[2]); +int isect_point_quad_v2(const float p[2], const float a[2], const float b[2], const float c[2], const float d[2]); -int isect_point_tri_v2(float v1[2], float v2[2], float v3[2], float pt[2]); -int isect_point_tri_v2_int(int x1, int y1, int x2, int y2, int a, int b); -int isect_point_tri_prism_v3(float p[3], float v1[3], float v2[3], float v3[3]); +int isect_point_tri_v2(const float v1[2], const float v2[2], const float v3[2], const float pt[2]); +int isect_point_tri_v2_int(const int x1, const int y1, const int x2, const int y2, const int a, const int b); +int isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3]); -void isect_point_quad_uv_v2(float v0[2], float v1[2], float v2[2], float v3[2], - float pt[2], float *uv); -void isect_point_face_uv_v2(int isquad, float v0[2], float v1[2], float v2[2], - float v3[2], float pt[2], float *uv); +void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], + const float pt[2], float *uv); +void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2], + const float v3[2], const float pt[2], float *uv); /* other */ -int isect_sweeping_sphere_tri_v3(float p1[3], float p2[3], float radius, - float v0[3], float v1[3], float v2[3], float *lambda, float *ipoint); +int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius, + const float v0[3], const float v1[3], const float v2[3], float *lambda, float ipoint[3]); -int isect_axial_line_tri_v3(int axis, float co1[3], float co2[3], - float v0[3], float v1[3], float v2[3], float *lambda); +int isect_axial_line_tri_v3(const int axis, const float co1[3], const float co2[3], + const float v0[3], const float v1[3], const float v2[3], float *lambda); -int isect_aabb_aabb_v3(float min1[3], float max1[3], float min2[3], float max2[3]); +int isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], const float max2[3]); -int clip_line_plane(float clipco[3], float plane[4], float co[3]); +int clip_line_plane(float p1[3], float p2[3], const float plane[4]); -void plot_line_v2v2i(int p1[2], int p2[2], int (*callback)(int, int, void *), void *userData); +void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int, void *), void *userData); /****************************** Interpolation ********************************/ /* tri or quad, d can be NULL */ void interp_weights_face_v3(float w[4], - float a[3], float b[3], float c[3], float d[3], float p[3]); -void interp_weights_poly_v3(float w[], float v[][3], int n, float p[3]); + const float a[3], const float b[3], const float c[3], const float d[3], const float p[3]); +void interp_weights_poly_v3(float w[], float v[][3], const int n, const float p[3]); void interp_cubic_v3(float x[3], float v[3], - float x1[3], float v1[3], float x2[3], float v2[3], float t); + const float x1[3], const float v1[3], const float x2[3], const float v2[3], const float t); -int interp_sparse_array(float *array, int list_size, float invalid); +int interp_sparse_array(float *array, const int list_size, const float invalid); void barycentric_transform(float pt_tar[3], float const pt_src[3], const float tri_tar_p1[3], const float tri_tar_p2[3], const float tri_tar_p3[3], @@ -152,22 +152,22 @@ void lookat_m4(float mat[4][4], float vx, float vy, void polarview_m4(float mat[4][4], float dist, float azimuth, float incidence, float twist); -void perspective_m4(float mat[4][4], float left, float right, - float bottom, float top, float nearClip, float farClip); -void orthographic_m4(float mat[4][4], float left, float right, - float bottom, float top, float nearClip, float farClip); +void perspective_m4(float mat[4][4], const float left, const float right, + const float bottom, const float top, const float nearClip, const float farClip); +void orthographic_m4(float mat[4][4], const float left, const float right, + const float bottom, const float top, const float nearClip, const float farClip); void window_translate_m4(float winmat[][4], float perspmat[][4], - float x, float y); + const float x, const float y); int box_clip_bounds_m4(float boundbox[2][3], - float bounds[4], float winmat[4][4]); + const float bounds[4], float winmat[4][4]); void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], float mat[4][4]); /********************************** Mapping **********************************/ -void map_to_tube(float *u, float *v, float x, float y, float z); -void map_to_sphere(float *u, float *v, float x, float y, float z); +void map_to_tube(float *u, float *v, const float x, const float y, const float z); +void map_to_sphere(float *u, float *v, const float x, const float y, const float z); /********************************** Normals **********************************/ @@ -182,11 +182,11 @@ typedef struct VertexTangent { float tang[3], uv[2]; } VertexTangent; -float *find_vertex_tangent(VertexTangent *vtang, float *uv); +float *find_vertex_tangent(VertexTangent *vtang, const float uv[2]); void sum_or_add_vertex_tangent(void *arena, VertexTangent **vtang, - float *tang, float *uv); -void tangent_from_uv(float *uv1, float *uv2, float *uv3, - float *co1, float *co2, float *co3, float *n, float *tang); + const float tang[3], const float uv[2]); +void tangent_from_uv(float uv1[2], float uv2[2], float uv3[2], + float co1[3], float co2[3], float co3[3], float n[3], float tang[3]); /******************************** Vector Clouds ******************************/ @@ -202,14 +202,14 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight, 4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */ MINLINE void zero_sh(float r[9]); -MINLINE void copy_sh_sh(float r[9], float a[9]); -MINLINE void mul_sh_fl(float r[9], float f); -MINLINE void add_sh_shsh(float r[9], float a[9], float b[9]); - -MINLINE float eval_shv3(float r[9], float v[3]); -MINLINE float diffuse_shv3(float r[9], float v[3]); -MINLINE void vec_fac_to_sh(float r[9], float v[3], float f); -MINLINE void madd_sh_shfl(float r[9], float sh[3], float f); +MINLINE void copy_sh_sh(float r[9], const float a[9]); +MINLINE void mul_sh_fl(float r[9], const float f); +MINLINE void add_sh_shsh(float r[9], const float a[9], const float b[9]); + +MINLINE float eval_shv3(float r[9], const float v[3]); +MINLINE float diffuse_shv3(float r[9], const float v[3]); +MINLINE void vec_fac_to_sh(float r[9], const float v[3], const float f); +MINLINE void madd_sh_shfl(float r[9], const float sh[3], const float f); /********************************* Form Factor *******************************/ |