diff options
Diffstat (limited to 'source')
18 files changed, 66 insertions, 130 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 13eca506d9e..046bb8e0e8d 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -250,7 +250,7 @@ void testhandles_fcurve(struct FCurve *fcu, const bool use_handle); void sort_time_fcurve(struct FCurve *fcu); short test_time_fcurve(struct FCurve *fcu); -void correct_bezpart(float *v1, float *v2, float *v3, float *v4); +void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2]); /* -------- Evaluation -------- */ diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 2ad6c54fb67..c1a76b67ee3 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -129,7 +129,7 @@ bool BKE_boundbox_ray_hit_check(struct BoundBox *bb, const float ray_start[3], c struct BoundBox *BKE_object_boundbox_get(struct Object *ob); void BKE_object_dimensions_get(struct Object *ob, float vec[3]); -void BKE_object_dimensions_set(struct Object *ob, const float *value); +void BKE_object_dimensions_set(struct Object *ob, const float value[3]); void BKE_object_empty_draw_type_set(struct Object *ob, const int value); void BKE_object_boundbox_flag(struct Object *ob, int flag, int set); void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 0ce2953a2e3..d56402525f0 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1929,7 +1929,8 @@ static int vergxcobev(const void *a1, const void *a2) /* this function cannot be replaced with atan2, but why? */ -static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *sina, float *cosa) +static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, + float *r_sina, float *r_cosa) { float t01, t02, x3, y3; @@ -1967,8 +1968,8 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si y3 /= t01; } - *sina = -y3 / t02; - *cosa = x3 / t02; + *r_sina = -y3 / t02; + *r_cosa = x3 / t02; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 88bd7d74743..be91cb5dc9d 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2519,7 +2519,7 @@ void BKE_object_dimensions_get(Object *ob, float vec[3]) } } -void BKE_object_dimensions_set(Object *ob, const float *value) +void BKE_object_dimensions_set(Object *ob, const float value[3]) { BoundBox *bb = NULL; diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 29ebf9f4688..7dcee518287 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -57,6 +57,7 @@ float area_tri_signed_v3(const float v1[3], const float v2[3], const float v3[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(const float verts[][3], unsigned int nr, const float normal[3]); float area_poly_v2(const float verts[][2], unsigned int nr); +float cotangent_tri_weight_v3(const float v1[3], const float v2[3], const float v3[3]); MINLINE float cross_tri_v2(const float v1[2], const float v2[2], const float v3[2]); float cross_poly_v2(const float verts[][2], unsigned int nr); diff --git a/source/blender/blenlib/BLI_noise.h b/source/blender/blenlib/BLI_noise.h index d9457fbaae7..f3292d26b1e 100644 --- a/source/blender/blenlib/BLI_noise.h +++ b/source/blender/blenlib/BLI_noise.h @@ -57,7 +57,7 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity void voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype); /* newnoise: cellNoise & cellNoiseV (for vector/point/color) */ float cellNoise(float x, float y, float z); -void cellNoiseV(float x, float y, float z, float *ca); +void cellNoiseV(float x, float y, float z, float r_ca[3]); #ifdef __cplusplus } diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 7665b8eedd0..71a6e195631 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -179,6 +179,24 @@ float area_poly_v2(const float verts[][2], unsigned int nr) return fabsf(0.5f * cross_poly_v2(verts, nr)); } +float cotangent_tri_weight_v3(const float v1[3], const float v2[3], const float v3[3]) +{ + float a[3], b[3], c[3], c_len; + + sub_v3_v3v3(a, v2, v1); + sub_v3_v3v3(b, v3, v1); + cross_v3_v3v3(c, a, b); + + c_len = len_v3(c); + + if (c_len > FLT_EPSILON) { + return dot_v3v3(a, b) / c_len; + } + else { + return 0.0f; + } +} + /********************************* Planes **********************************/ /** diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 982a74b1ffd..f002ea54b32 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -1407,7 +1407,7 @@ float cellNoise(float x, float y, float z) } /* returns a vector/point/color in ca, using point hasharray directly */ -void cellNoiseV(float x, float y, float z, float *ca) +void cellNoiseV(float x, float y, float z, float ca[3]) { int xi = (int)(floor(x)); int yi = (int)(floor(y)); diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c index e6321341950..af5f35f2a75 100644 --- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c +++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c @@ -66,7 +66,6 @@ struct BLaplacianSystem { }; typedef struct BLaplacianSystem LaplacianSystem; -static float cotan_weight(float *v1, float *v2, float *v3); static bool vert_is_boundary(BMVert *v); static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts); static void init_laplacian_matrix(LaplacianSystem *sys); @@ -261,9 +260,9 @@ static void init_laplacian_matrix(LaplacianSystem *sys) v3 = vf[(j + 2) % 4]->co; v4 = vf[(j + 3) % 4]->co; - w2 = cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2); - w3 = cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3); - w4 = cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1); + w2 = cotangent_tri_weight_v3(v4, v1, v2) + cotangent_tri_weight_v3(v3, v1, v2); + w3 = cotangent_tri_weight_v3(v2, v3, v1) + cotangent_tri_weight_v3(v4, v1, v3); + w4 = cotangent_tri_weight_v3(v2, v4, v1) + cotangent_tri_weight_v3(v3, v4, v1); sys->vweights[idv1] += (w2 + w3 + w4) / 4.0f; } @@ -271,9 +270,9 @@ static void init_laplacian_matrix(LaplacianSystem *sys) else { i = BM_elem_index_get(f); - w1 = cotan_weight(v1, v2, v3); - w2 = cotan_weight(v2, v3, v1); - w3 = cotan_weight(v3, v1, v2); + w1 = cotangent_tri_weight_v3(v1, v2, v3); + w2 = cotangent_tri_weight_v3(v2, v3, v1); + w3 = cotangent_tri_weight_v3(v3, v1, v2); sys->fweights[i][0] += w1; sys->fweights[i][1] += w2; @@ -325,9 +324,9 @@ static void fill_laplacian_matrix(LaplacianSystem *sys) v3 = vf[(j + 2) % 4]->co; v4 = vf[(j + 3) % 4]->co; - w2 = cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2); - w3 = cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3); - w4 = cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1); + w2 = cotangent_tri_weight_v3(v4, v1, v2) + cotangent_tri_weight_v3(v3, v1, v2); + w3 = cotangent_tri_weight_v3(v2, v3, v1) + cotangent_tri_weight_v3(v4, v1, v3); + w4 = cotangent_tri_weight_v3(v2, v4, v1) + cotangent_tri_weight_v3(v3, v4, v1); w2 = w2 / 4.0f; w3 = w3 / 4.0f; @@ -376,22 +375,6 @@ static void fill_laplacian_matrix(LaplacianSystem *sys) } } -static float cotan_weight(float *v1, float *v2, float *v3) -{ - float a[3], b[3], c[3], clen; - - sub_v3_v3v3(a, v2, v1); - sub_v3_v3v3(b, v3, v1); - cross_v3_v3v3(c, a, b); - - clen = len_v3(c); - - if (clen == 0.0f) - return 0.0f; - - return dot_v3v3(a, b) / clen; -} - static bool vert_is_boundary(BMVert *v) { BMEdge *ed; diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 017d2783c1d..bc47a673365 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -140,22 +140,6 @@ static int laplacian_edge_count(EdgeHash *edgehash, int v1, int v2) return (int)(intptr_t)BLI_edgehash_lookup(edgehash, v1, v2); } -static float cotan_weight(float *v1, float *v2, float *v3) -{ - float a[3], b[3], c[3], clen; - - sub_v3_v3v3(a, v2, v1); - sub_v3_v3v3(b, v3, v1); - cross_v3_v3v3(c, a, b); - - clen = len_v3(c); - - if (clen == 0.0f) - return 0.0f; - - return dot_v3v3(a, b) / clen; -} - static void laplacian_triangle_area(LaplacianSystem *sys, int i1, int i2, int i3) { float t1, t2, t3, len1, len2, len3, area; @@ -166,9 +150,9 @@ static void laplacian_triangle_area(LaplacianSystem *sys, int i1, int i2, int i3 v2 = sys->verts[i2]; v3 = sys->verts[i3]; - t1 = cotan_weight(v1, v2, v3); - t2 = cotan_weight(v2, v3, v1); - t3 = cotan_weight(v3, v1, v2); + t1 = cotangent_tri_weight_v3(v1, v2, v3); + t2 = cotangent_tri_weight_v3(v2, v3, v1); + t3 = cotangent_tri_weight_v3(v3, v1, v2); if (angle_v3v3v3(v2, v1, v3) > DEG2RADF(90.0f)) obtuse = 1; else if (angle_v3v3v3(v1, v2, v3) > DEG2RADF(90.0f)) obtuse = 2; @@ -207,9 +191,9 @@ static void laplacian_triangle_weights(LaplacianSystem *sys, int f, int i1, int /* instead of *0.5 we divided by the number of faces of the edge, it still * needs to be verified that this is indeed the correct thing to do! */ - t1 = cotan_weight(v1, v2, v3) / laplacian_edge_count(sys->edgehash, i2, i3); - t2 = cotan_weight(v2, v3, v1) / laplacian_edge_count(sys->edgehash, i3, i1); - t3 = cotan_weight(v3, v1, v2) / laplacian_edge_count(sys->edgehash, i1, i2); + t1 = cotangent_tri_weight_v3(v1, v2, v3) / laplacian_edge_count(sys->edgehash, i2, i3); + t2 = cotangent_tri_weight_v3(v2, v3, v1) / laplacian_edge_count(sys->edgehash, i3, i1); + t3 = cotangent_tri_weight_v3(v3, v1, v2) / laplacian_edge_count(sys->edgehash, i1, i2); nlMatrixAdd(i1, i1, (t2 + t3) * varea[i1]); nlMatrixAdd(i2, i2, (t1 + t3) * varea[i2]); diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index d521de54576..e36b5c808dc 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -2497,32 +2497,16 @@ int weightFromLoc(EditMesh *em, int axis) return 1; } -static float cotan_weight(float *v1, float *v2, float *v3) -{ - float a[3], b[3], c[3], clen; - - sub_v3_v3v3(a, v2, v1); - sub_v3_v3v3(b, v3, v1); - cross_v3_v3v3(c, a, b); - - clen = len_v3(c); - - if (clen == 0.0f) - return 0.0f; - - return dot_v3v3(a, b) / clen; -} - static void addTriangle(EditVert *v1, EditVert *v2, EditVert *v3, int e1, int e2, int e3) { /* Angle opposite e1 */ - float t1 = cotan_weight(v1->co, v2->co, v3->co) / e2; + float t1 = cotangent_tri_weight_v3(v1->co, v2->co, v3->co) / e2; /* Angle opposite e2 */ - float t2 = cotan_weight(v2->co, v3->co, v1->co) / e3; + float t2 = cotangent_tri_weight_v3(v2->co, v3->co, v1->co) / e3; /* Angle opposite e3 */ - float t3 = cotan_weight(v3->co, v1->co, v2->co) / e1; + float t3 = cotangent_tri_weight_v3(v3->co, v1->co, v2->co) / e1; int i1 = indexData(v1); int i2 = indexData(v2); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index d2714639a56..fc7165ea1f5 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -1671,7 +1671,7 @@ static void scale_tri(float insetCos[4][3], float *origCos[4], const float inset } #endif //PROJ_DEBUG_NOSEAMBLEED -static float len_squared_v2v2_alt(const float *v1, const float v2_1, const float v2_2) +static float len_squared_v2v2_alt(const float v1[2], const float v2_1, const float v2_2) { float x, y; diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index 45b835810ed..b0de9dda6cd 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -166,7 +166,7 @@ static void find_nearest_tracking_knot_cb(void *userdata, MovieTrackingTrack *tr } -static void mouse_select_init_data(MouseSelectUserData *userdata, float *co) +static void mouse_select_init_data(MouseSelectUserData *userdata, const float co[2]) { memset(userdata, 0, sizeof(MouseSelectUserData)); userdata->min_dist = FLT_MAX; diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 08375faf680..632bf1d3b14 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -584,7 +584,7 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node) } /* this might have some more generic use */ -static void node_circle_draw(float x, float y, float size, float *col, int highlight) +static void node_circle_draw(float x, float y, float size, const float col[4], int highlight) { /* 16 values of sin function */ static float si[16] = { diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 3f8166216ba..e574d1ad469 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -498,8 +498,8 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2]); void projectFloatViewEx(TransInfo *t, const float vec[3], float adr[2], const eV3DProjTest flag); void projectFloatView(TransInfo *t, const float vec[3], float adr[2]); -void applyAspectRatio(TransInfo *t, float *vec); -void removeAspectRatio(TransInfo *t, float *vec); +void applyAspectRatio(TransInfo *t, float vec[2]); +void removeAspectRatio(TransInfo *t, float vec[2]); void drawPropCircle(const struct bContext *C, TransInfo *t); diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 8e2a58b2236..31bae2a192e 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -138,24 +138,6 @@ static void deleteLaplacianSystem(LaplacianSystem *sys) MEM_SAFE_FREE(sys); } -static float cotan_weight(const float v1[3], const float v2[3], const float v3[3]) -{ - float a[3], b[3], c[3], clen; - - sub_v3_v3v3(a, v2, v1); - sub_v3_v3v3(b, v3, v1); - cross_v3_v3v3(c, a, b); - - clen = len_v3(c); - - if (clen > FLT_EPSILON) { - return dot_v3v3(a, b) / clen; - } - else { - return 0.0f; - } -} - static void createFaceRingMap( const int mvert_tot, const MFace *mface, const int mface_tot, MeshElemMap **r_map, int **r_indices) @@ -306,9 +288,9 @@ static void initLaplacianMatrix(LaplacianSystem *sys) if (has_4_vert) { - w2 = (cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2)) / 2.0f; - w3 = (cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3)) / 2.0f; - w4 = (cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1)) / 2.0f; + w2 = (cotangent_tri_weight_v3(v4, v1, v2) + cotangent_tri_weight_v3(v3, v1, v2)) / 2.0f; + w3 = (cotangent_tri_weight_v3(v2, v3, v1) + cotangent_tri_weight_v3(v4, v1, v3)) / 2.0f; + w4 = (cotangent_tri_weight_v3(v2, v4, v1) + cotangent_tri_weight_v3(v3, v4, v1)) / 2.0f; sys->delta[idv1][0] -= v4[0] * w4; sys->delta[idv1][1] -= v4[1] * w4; @@ -321,8 +303,8 @@ static void initLaplacianMatrix(LaplacianSystem *sys) nlMatrixAdd(idv1, idv4, -w4); } else { - w2 = cotan_weight(v3, v1, v2); - w3 = cotan_weight(v2, v3, v1); + w2 = cotangent_tri_weight_v3(v3, v1, v2); + w3 = cotangent_tri_weight_v3(v2, v3, v1); w4 = 0.0f; } diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index 130013af75b..e494fbf23fd 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -88,7 +88,6 @@ static CustomDataMask required_data_mask(Object *ob, ModifierData *md); static bool is_disabled(ModifierData *md, int useRenderParams); static float average_area_quad_v3(float *v1, float *v2, float *v3, float *v4); static float compute_volume(float (*vertexCos)[3], MFace *mfaces, int numFaces); -static float cotan_weight(float *v1, float *v2, float *v3); static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts); static void copy_data(ModifierData *md, ModifierData *target); static void delete_laplacian_system(LaplacianSystem *sys); @@ -204,22 +203,6 @@ static float average_area_quad_v3(float *v1, float *v2, float *v3, float *v4) return areaq / 2.0f; } -static float cotan_weight(float *v1, float *v2, float *v3) -{ - float a[3], b[3], c[3], clen; - - sub_v3_v3v3(a, v2, v1); - sub_v3_v3v3(b, v3, v1); - cross_v3_v3v3(c, a, b); - - clen = len_v3(c); - - if (clen == 0.0f) - return 0.0f; - - return dot_v3v3(a, b) / clen; -} - static float compute_volume(float (*vertexCos)[3], MFace *mfaces, int numFaces) { float vol = 0.0f; @@ -367,17 +350,17 @@ static void init_laplacian_matrix(LaplacianSystem *sys) v3 = sys->vertexCos[idv3]; v4 = sys->vertexCos[idv4]; - w2 = cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2); - w3 = cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3); - w4 = cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1); + w2 = cotangent_tri_weight_v3(v4, v1, v2) + cotangent_tri_weight_v3(v3, v1, v2); + w3 = cotangent_tri_weight_v3(v2, v3, v1) + cotangent_tri_weight_v3(v4, v1, v3); + w4 = cotangent_tri_weight_v3(v2, v4, v1) + cotangent_tri_weight_v3(v3, v4, v1); sys->vweights[idv1] += (w2 + w3 + w4) / 4.0f; } } else { - w1 = cotan_weight(v1, v2, v3) / 2.0f; - w2 = cotan_weight(v2, v3, v1) / 2.0f; - w3 = cotan_weight(v3, v1, v2) / 2.0f; + w1 = cotangent_tri_weight_v3(v1, v2, v3) / 2.0f; + w2 = cotangent_tri_weight_v3(v2, v3, v1) / 2.0f; + w3 = cotangent_tri_weight_v3(v3, v1, v2) / 2.0f; sys->fweights[i][0] = sys->fweights[i][0] + w1; sys->fweights[i][1] = sys->fweights[i][1] + w2; @@ -430,9 +413,9 @@ static void fill_laplacian_matrix(LaplacianSystem *sys) v3 = sys->vertexCos[idv3]; v4 = sys->vertexCos[idv4]; - w2 = cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2); - w3 = cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3); - w4 = cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1); + w2 = cotangent_tri_weight_v3(v4, v1, v2) + cotangent_tri_weight_v3(v3, v1, v2); + w3 = cotangent_tri_weight_v3(v2, v3, v1) + cotangent_tri_weight_v3(v4, v1, v3); + w4 = cotangent_tri_weight_v3(v2, v4, v1) + cotangent_tri_weight_v3(v3, v4, v1); w2 = w2 / 4.0f; w3 = w3 / 4.0f; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 61dcc1fbb9d..e8eb9c5675d 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -130,7 +130,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, } } -static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3], float *vec) +static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3], float vec[3]) { MDefCell *cell; MDefInfluence *inf; |