From 90293a8da375b785fa58d3f56de1b286072107c1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 23 Jan 2016 13:44:20 +1100 Subject: Math Lib: optimize segment-plane clipping Calculate the clipped min/max factor along the segment, only applying to the coordinates at the end (will give better precision too). Also make split input/output args. --- source/blender/blenlib/BLI_math_geom.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source/blender/blenlib/BLI_math_geom.h') diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index e3a8f975844..06412835936 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -288,8 +288,12 @@ bool isect_ray_aabb_v3( 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 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); +bool clip_segment_v3_plane( + const float p1[3], const float p2[3], const float plane[4], + float r_p1[3], float r_p2[3]); +bool clip_segment_v3_plane_n( + const float p1[3], const float p2[3], const float plane_array[][4], const int plane_tot, + float r_p1[3], float r_p2[3]); void plot_line_v2v2i(const int p1[2], const int p2[2], bool (*callback)(int, int, void *), void *userData); void fill_poly_v2i_n( -- cgit v1.2.3