Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/intern/particle_distribute.c4
-rw-r--r--source/blender/blenkernel/intern/softbody.c8
-rw-r--r--source/blender/blenlib/BLI_math_geom.h16
-rw-r--r--source/blender/blenlib/intern/math_geom.c13
-rw-r--r--source/blender/bmesh/tools/bmesh_intersect.c2
-rw-r--r--source/blender/editors/physics/particle_edit.c4
6 files changed, 25 insertions, 22 deletions
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index 87bc355894d..0c7d85967f3 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -220,7 +220,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
copy_v3_v3(v2, mvert[mface->v2].co);
copy_v3_v3(v3, mvert[mface->v3].co);
- if (isect_axial_line_tri_v3(a, co1, co2, v2, v3, v1, &lambda)) {
+ if (isect_axial_line_segment_tri_v3(a, co1, co2, v2, v3, v1, &lambda)) {
if (from==PART_FROM_FACE)
(pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
else /* store number of intersections */
@@ -229,7 +229,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
else if (mface->v4) {
copy_v3_v3(v4, mvert[mface->v4].co);
- if (isect_axial_line_tri_v3(a, co1, co2, v4, v1, v3, &lambda)) {
+ if (isect_axial_line_segment_tri_v3(a, co1, co2, v4, v1, v3, &lambda)) {
if (from==PART_FROM_FACE)
(pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
else
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 1c3ff3d3e02..25a4fdc0cc7 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -1213,9 +1213,9 @@ static int sb_detect_face_collisionCached(float face_v1[3], float face_v2[3], fl
sub_v3_v3v3(edge2, nv3, nv2);
cross_v3_v3v3(d_nvect, edge2, edge1);
normalize_v3(d_nvect);
- if (isect_line_tri_v3(nv1, nv2, face_v1, face_v2, face_v3, &t, NULL) ||
- isect_line_tri_v3(nv2, nv3, face_v1, face_v2, face_v3, &t, NULL) ||
- isect_line_tri_v3(nv3, nv1, face_v1, face_v2, face_v3, &t, NULL) )
+ if (isect_line_segment_tri_v3(nv1, nv2, face_v1, face_v2, face_v3, &t, NULL) ||
+ isect_line_segment_tri_v3(nv2, nv3, face_v1, face_v2, face_v3, &t, NULL) ||
+ isect_line_segment_tri_v3(nv3, nv1, face_v1, face_v2, face_v3, &t, NULL) )
{
madd_v3_v3fl(force, d_nvect, -0.5f);
*damp=tune*ob->pd->pdef_sbdamp;
@@ -1396,7 +1396,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3], float edge_v2[3], fl
cross_v3_v3v3(d_nvect, edge2, edge1);
normalize_v3(d_nvect);
- if ( isect_line_tri_v3(edge_v1, edge_v2, nv1, nv2, nv3, &t, NULL)) {
+ if (isect_line_segment_tri_v3(edge_v1, edge_v2, nv1, nv2, nv3, &t, NULL)) {
float v1[3], v2[3];
float intrusiondepth, i1, i2;
sub_v3_v3v3(v1, edge_v1, nv2);
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 9f8f010d586..d8e2b7f5e4c 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -186,8 +186,9 @@ bool isect_ray_plane_v3(
float *r_lambda, const bool clip);
bool isect_point_planes_v3(float (*planes)[4], int totplane, const float p[3]);
-bool isect_line_plane_v3(float out[3], const float l1[3], const float l2[3],
- const float plane_co[3], const float plane_no[3]) ATTR_WARN_UNUSED_RESULT;
+bool isect_line_plane_v3(
+ float r_isect_co[3], const float l1[3], const float l2[3],
+ const float plane_co[3], const float plane_no[3]) ATTR_WARN_UNUSED_RESULT;
bool isect_plane_plane_plane_v3(
const float plane_a[4], const float plane_b[4], const float plane_c[4],
@@ -197,14 +198,18 @@ bool isect_plane_plane_v3(
float r_isect_co[3], float r_isect_no[3]) ATTR_WARN_UNUSED_RESULT;
/* line/ray triangle */
-bool isect_line_tri_v3(
+bool isect_line_segment_tri_v3(
const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2]);
-bool isect_line_tri_epsilon_v3(
+bool isect_line_segment_tri_epsilon_v3(
const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2], const float epsilon);
+bool isect_axial_line_segment_tri_v3(
+ const int axis, const float p1[3], const float p2[3],
+ const float v0[3], const float v1[3], const float v2[3], float *r_lambda);
+
bool isect_ray_tri_v3(
const float ray_origin[3], const float ray_direction[3],
const float v0[3], const float v1[3], const float v2[3],
@@ -279,9 +284,6 @@ bool isect_ray_aabb(const IsectRayAABBData *data, const float bb_min[3], const f
bool 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 *r_lambda, float ipoint[3]);
-bool 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 *r_lambda);
-
bool clip_segment_v3_plane(float p1[3], float p2[3], const float plane[4]);
bool clip_segment_v3_plane_n(float p1[3], float p2[3], float plane_array[][4], const int plane_tot);
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index e635d3c99f1..25d40bc3f5e 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -1131,7 +1131,7 @@ int isect_point_quad_v2(const float pt[2], const float v1[2], const float v2[2],
* test if the line starting at p1 ending at p2 intersects the triangle v0..v2
* return non zero if it does
*/
-bool isect_line_tri_v3(
+bool isect_line_segment_tri_v3(
const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2])
@@ -1170,8 +1170,8 @@ bool isect_line_tri_v3(
return true;
}
-/* like isect_line_tri_v3, but allows epsilon tolerance around triangle */
-bool isect_line_tri_epsilon_v3(
+/* like isect_line_segment_tri_v3, but allows epsilon tolerance around triangle */
+bool isect_line_segment_tri_epsilon_v3(
const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2], const float epsilon)
@@ -2002,8 +2002,9 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const fl
return found_by_sweep;
}
-bool isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3],
- const float v0[3], const float v1[3], const float v2[3], float *r_lambda)
+bool isect_axial_line_segment_tri_v3(
+ const int axis, const float p1[3], const float p2[3],
+ const float v0[3], const float v1[3], const float v2[3], float *r_lambda)
{
const float epsilon = 0.000001f;
float p[3], e1[3], e2[3];
@@ -2011,7 +2012,7 @@ bool isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3
int a0 = axis, a1 = (axis + 1) % 3, a2 = (axis + 2) % 3;
#if 0
- return isect_line_tri_v3(p1, p2, v0, v1, v2, lambda);
+ return isect_line_segment_tri_v3(p1, p2, v0, v1, v2, lambda);
/* first a simple bounding box test */
if (min_fff(v0[a1], v1[a1], v2[a1]) > p1[a1]) return false;
diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c
index e177af9df91..0d5e0a8c584 100644
--- a/source/blender/bmesh/tools/bmesh_intersect.c
+++ b/source/blender/bmesh/tools/bmesh_intersect.c
@@ -344,7 +344,7 @@ static enum ISectType intersect_line_tri(
/* check ray isn't planar with tri */
if (fabsf(dot_v3v3(p_dir, t_nor)) >= e->eps) {
- if (isect_line_tri_epsilon_v3(p0, p1, t_cos[0], t_cos[1], t_cos[2], &fac, NULL, 0.0f)) {
+ if (isect_line_segment_tri_epsilon_v3(p0, p1, t_cos[0], t_cos[1], t_cos[2], &fac, NULL, 0.0f)) {
if ((fac >= e->eps_margin) && (fac <= 1.0f - e->eps_margin)) {
interp_v3_v3v3(r_ix, p0, p1, fac);
if (min_fff(len_squared_v3v3(t_cos[0], r_ix),
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 32cd1f7a1ce..64ad3a100cc 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3416,7 +3416,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
}
}
else {
- if (isect_line_tri_v3(co1, co2, v1, v2, v3, &cur_d, cur_uv)) {
+ if (isect_line_segment_tri_v3(co1, co2, v1, v2, v3, &cur_d, cur_uv)) {
if (cur_d<*min_d) {
*min_d=cur_d;
min_w[0] = 1.0f - cur_uv[0] - cur_uv[1];
@@ -3430,7 +3430,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
}
}
if (mface->v4) {
- if (isect_line_tri_v3(co1, co2, v1, v3, v4, &cur_d, cur_uv)) {
+ if (isect_line_segment_tri_v3(co1, co2, v1, v3, v4, &cur_d, cur_uv)) {
if (cur_d<*min_d) {
*min_d=cur_d;
min_w[0] = 1.0f - cur_uv[0] - cur_uv[1];