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:
authorCampbell Barton <campbell@blender.org>2022-07-27 12:48:17 +0300
committerCampbell Barton <campbell@blender.org>2022-07-28 02:39:54 +0300
commit8d4fa03e5c87e8f83ef19557d673625766d5a148 (patch)
tree5717ba3908cacdded0992e587868148f226dc2a9 /source/blender/blenlib/BLI_math_rotation.h
parentff048f5d27c4b785f5d6807eb14416ff308ca5ef (diff)
BLI_math: improve symmetrical values from sin_cos_from_fraction
When plotting equally distant points around a circle support an extra axis of symmetry so twice as many exact values are repeated than originally added in [0], see code-comments for a detailed explanation. Tests to ensure accuracy and exact symmetry have been added too. Follow up on fix for T87779. [0]: 087f27a52f7857887e90754d87a7a73715ebc3fb
Diffstat (limited to 'source/blender/blenlib/BLI_math_rotation.h')
-rw-r--r--source/blender/blenlib/BLI_math_rotation.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h
index fef51fa780e..3987c9daf0a 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -177,10 +177,9 @@ void mat3_to_quat_is_ok(float q[4], const float mat[3][3]);
/* Other. */
/**
- * Utility function that performs `sinf` & `cosf` where the quadrants of the circle
- * will have exactly matching values when their sign is flipped.
- * This works as long as the denominator can be divided by 2 or 4,
- * otherwise `sinf` & `cosf` are used without any additional logic.
+ * Utility that performs `sinf` & `cosf` intended for plotting a 2D circle,
+ * where the values of the coordinates with are exactly symmetrical although this
+ * favors even numbers as odd numbers can only be symmetrical on a single axis.
*
* Besides adjustments to precision, this function is the equivalent of:
* \code {.c}
@@ -194,7 +193,7 @@ void mat3_to_quat_is_ok(float q[4], const float mat[3][3]);
* \param r_sin: The resulting sine.
* \param r_cos: The resulting cosine.
*/
-void sin_cos_from_fraction(const int numerator, const int denominator, float *r_sin, float *r_cos);
+void sin_cos_from_fraction(int numerator, int denominator, float *r_sin, float *r_cos);
void print_qt(const char *str, const float q[4]);