Changeset View
Changeset View
Standalone View
Standalone View
source/blender/bmesh/tools/bmesh_bevel.c
| Show First 20 Lines • Show All 5,658 Lines • ▼ Show 20 Lines | else { | ||||
| xnew = xmax - dmaxerr * (xmax - xmin) / (dmaxerr - dminerr); | xnew = xmax - dmaxerr * (xmax - xmin) / (dmaxerr - dminerr); | ||||
| } | } | ||||
| lastupdated_upper = true; | lastupdated_upper = true; | ||||
| } | } | ||||
| } | } | ||||
| return xnew; | return xnew; | ||||
| } | } | ||||
| /* This search procedure to find equidistant points (x,y) in the first | /** | ||||
| * This search procedure to find equidistant points (x,y) in the first | |||||
| * superellipse quadrant works for every superellipse exponent but is more | * superellipse quadrant works for every superellipse exponent but is more | ||||
| * expensive than known solutions for special cases. | * expensive than known solutions for special cases. | ||||
| * Call the point on superellipse that intersects x=y line mx. | * Call the point on superellipse that intersects x=y line mx. | ||||
| * For r>=1 use only the range x in [0,mx] and mirror the rest along x=y line, | * For r>=1 use only the range x in [0,mx] and mirror the rest along x=y line, | ||||
| * for r<1 use only x in [mx,1]. Points are initially spaced and iteratively | * for r<1 use only x in [mx,1]. Points are initially spaced and iteratively | ||||
| * repositioned to have the same distance. */ | * repositioned to have the same distance. | ||||
| */ | |||||
| static void find_even_superellipse_chords_general(int seg, float r, double *xvals, double *yvals) | static void find_even_superellipse_chords_general(int seg, float r, double *xvals, double *yvals) | ||||
| { | { | ||||
| const int smoothitermax = 10; | const int smoothitermax = 10; | ||||
| const double error_tol = 1e-7; | const double error_tol = 1e-7; | ||||
| int i; | int i; | ||||
| int imax = (seg + 1) / 2 - 1; /* ceiling division - 1 */ | int imax = (seg + 1) / 2 - 1; /* ceiling division - 1 */ | ||||
| double d, dmin, dmax; | double d, dmin, dmax; | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | if (!rbig) { | ||||
| for (i = 0; i <= seg; i++) { | for (i = 0; i <= seg; i++) { | ||||
| temp = xvals[i]; | temp = xvals[i]; | ||||
| xvals[i] = 1.0 - yvals[i]; | xvals[i] = 1.0 - yvals[i]; | ||||
| yvals[i] = 1.0 - temp; | yvals[i] = 1.0 - temp; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Find equidistant points (x0,y0), (x1,y1)... (xn,yn) on the superellipse | /** | ||||
| * Find equidistant points (x0,y0), (x1,y1)... (xn,yn) on the superellipse | |||||
| * function in the first quadrant. For special profiles (linear, arc, | * function in the first quadrant. For special profiles (linear, arc, | ||||
| * rectangle) the point can be calculated easily, for any other profile a more | * rectangle) the point can be calculated easily, for any other profile a more | ||||
| * expensive search procedure must be used because there is no known closed | * expensive search procedure must be used because there is no known closed | ||||
| * form for equidistant parametrization | * form for equidistant parametrization | ||||
| * xvals and yvals should be size n+1 */ | * xvals and yvals should be size n+1 | ||||
| */ | |||||
| static void find_even_superellipse_chords(int n, float r, double *xvals, double *yvals) | static void find_even_superellipse_chords(int n, float r, double *xvals, double *yvals) | ||||
| { | { | ||||
| int i, n2; | int i, n2; | ||||
| double temp; | double temp; | ||||
| bool seg_odd = n % 2; | bool seg_odd = n % 2; | ||||
| n2 = n / 2; | n2 = n / 2; | ||||
| ▲ Show 20 Lines • Show All 471 Lines • Show Last 20 Lines | |||||