]>
git.tdb.fi Git - libs/math.git/log
Mikko Rasa [Thu, 30 Jan 2025 18:28:06 +0000 (20:28 +0200)]
Add some shorthand syntaxes for angles and quaternions
Mikko Rasa [Sun, 26 Jan 2025 20:38:15 +0000 (22:38 +0200)]
Add an explicit cast to satisfy MSVC
Mikko Rasa [Sun, 26 Jan 2025 16:53:25 +0000 (18:53 +0200)]
Add a Sphere convenience class
For some reason this was missing even though there's Rectangle, Box and
Circle.
Mikko Rasa [Sun, 26 Jan 2025 15:09:52 +0000 (17:09 +0200)]
Add a function to convert a matrix into a quaternion
Currently it only accepts orthonormal matrices.
Mikko Rasa [Sun, 26 Jan 2025 15:09:13 +0000 (17:09 +0200)]
Fix scaling in quaternion-to-matrix conversion
Mikko Rasa [Sun, 26 Jan 2025 10:23:03 +0000 (12:23 +0200)]
Simplify Loader initialization with a constexpr if
Mikko Rasa [Sun, 26 Jan 2025 10:21:59 +0000 (12:21 +0200)]
Use vector and deque instead of list
Mikko Rasa [Sun, 26 Jan 2025 00:16:20 +0000 (02:16 +0200)]
Replace typedef with using
Also remove one type alias which was no longer useful
Mikko Rasa [Sun, 26 Jan 2025 00:00:50 +0000 (02:00 +0200)]
Use unique_ptr for managing memory allocations
Mikko Rasa [Sat, 25 Jan 2025 23:59:00 +0000 (01:59 +0200)]
Fix incorrect member access operator
Mikko Rasa [Sat, 25 Jan 2025 23:21:37 +0000 (01:21 +0200)]
Use range-based for loops where appropriate
Mikko Rasa [Sat, 25 Jan 2025 23:05:52 +0000 (01:05 +0200)]
Use the override specifier on overridden virtual functions
Mikko Rasa [Sat, 16 Sep 2023 11:40:14 +0000 (14:40 +0300)]
Ignore Windows build products
Mikko Rasa [Tue, 5 Sep 2023 10:24:31 +0000 (13:24 +0300)]
Explicitly convert literals to the T type
Otherwise MSVC will complain about conversion to float when T is float.
Mikko Rasa [Tue, 5 Sep 2023 09:20:49 +0000 (12:20 +0300)]
Add a dummy function to trigger import library generation on MSVC
Really this should be marked as static-only / no-library, but builder
does not support that yet.
Mikko Rasa [Sat, 28 Jan 2023 19:45:31 +0000 (21:45 +0200)]
Add a function to create a rotation quaternion from two vectors
Mikko Rasa [Sat, 28 Jan 2023 19:45:19 +0000 (21:45 +0200)]
Normalize the axis in Quaternion::rotation
Mikko Rasa [Mon, 23 Jan 2023 15:07:33 +0000 (17:07 +0200)]
Implement the Quaternion::normalize() function
For some reason it was forgotten when the class was added
Mikko Rasa [Mon, 23 Jan 2023 15:06:42 +0000 (17:06 +0200)]
Use a constexpr integer to define constant value
Mikko Rasa [Mon, 23 Jan 2023 15:01:51 +0000 (17:01 +0200)]
Use nullptr instead of 0
Mikko Rasa [Mon, 23 Jan 2023 15:01:25 +0000 (17:01 +0200)]
Remove unnecessary destructors from exceptions
Mikko Rasa [Mon, 23 Jan 2023 14:56:56 +0000 (16:56 +0200)]
Use default members initializers and defaulted special members
Mikko Rasa [Mon, 23 Jan 2023 11:48:55 +0000 (13:48 +0200)]
Add a missing condition to BoundingBox subtraction
If the positive box extends to both sides of the negative box, the result
should be equal to the positive box.
Mikko Rasa [Mon, 23 Jan 2023 11:38:50 +0000 (13:38 +0200)]
Adjust test cases to match changes in the library
Mikko Rasa [Thu, 5 Jan 2023 23:12:17 +0000 (01:12 +0200)]
Add the math library as an exported library on Linux
Some template code here uses functions from it, so users of this package
must link the library for template instantiations to work.
Mikko Rasa [Mon, 31 Oct 2022 07:28:54 +0000 (09:28 +0200)]
Add a Quaternion class
Mikko Rasa [Sat, 15 Oct 2022 10:38:19 +0000 (13:38 +0300)]
Don't use references to angles
It holds a single scalar and is trivial to copy, so can be passed in a
register.
Mikko Rasa [Mon, 14 Mar 2022 06:52:06 +0000 (08:52 +0200)]
Rename AffineTransformation to AffineTransform
This seems like a more appropriate term for the operation.
Mikko Rasa [Sun, 13 Mar 2022 20:08:58 +0000 (22:08 +0200)]
Remove SquareMatrix and instead use static_assert to check squareness
Mikko Rasa [Sun, 13 Mar 2022 19:32:47 +0000 (21:32 +0200)]
Make gauss_jordan operate on columns instead of rows
Since matrices are stored in column-major order, this makes the algorithm
more amenable to possible simdification.
Mikko Rasa [Sun, 13 Mar 2022 19:30:11 +0000 (21:30 +0200)]
Require C++11 for building
Mikko Rasa [Sun, 13 Mar 2022 19:29:31 +0000 (21:29 +0200)]
Assign a version number
Mikko Rasa [Wed, 30 Dec 2020 15:14:55 +0000 (17:14 +0200)]
Support Matrix multiplication operators on SquareMatrix
Mikko Rasa [Fri, 7 Jun 2019 23:16:06 +0000 (02:16 +0300)]
Add a bezier spline type
Mikko Rasa [Thu, 6 Jun 2019 13:01:39 +0000 (16:01 +0300)]
Remove a stray include
I thought of moving SplineKnot to a separate header but decided against
it (for now) and this got left behind.
Mikko Rasa [Wed, 5 Jun 2019 21:22:10 +0000 (00:22 +0300)]
Add a simple linearly interpolated "spline"
Mikko Rasa [Wed, 5 Jun 2019 19:25:02 +0000 (22:25 +0300)]
Fix a missing return in assignment operator
Mikko Rasa [Wed, 5 Jun 2019 19:24:35 +0000 (22:24 +0300)]
Move a #include to where it's actually used
Mikko Rasa [Tue, 4 Jun 2019 13:37:36 +0000 (16:37 +0300)]
Move the Knot struct out of Spline
It doesn't depend on the degree of the spline, so this will generate less
different types and make it easier to create splines of different degrees
from the same knots.
Mikko Rasa [Sun, 2 Jun 2019 16:13:14 +0000 (19:13 +0300)]
Add an interpolation sub-library
Initially including polynomials and splines, with cubic Hermite splines
being the only implemented spline type.
Mikko Rasa [Sun, 2 Jun 2019 13:23:08 +0000 (16:23 +0300)]
Fix a memory access error in DynamicMatrix::invert
Gauss_jordan returns a reference to the result, which is a local
variable. It needs to be assigned to *this to retain it.
Mikko Rasa [Sun, 2 Jun 2019 13:22:24 +0000 (16:22 +0300)]
Copy Matrix test cases for DynamicMatrix
Mikko Rasa [Sun, 2 Jun 2019 13:21:40 +0000 (16:21 +0300)]
Improve readability of Matrix test cases with typedefs
Mikko Rasa [Sun, 2 Jun 2019 12:28:34 +0000 (15:28 +0300)]
Improve Vector constructor for C++11
The new overload allows vectors of any size to be constructed by passing
the component values as constructor arguments.
Mikko Rasa [Sun, 2 Jun 2019 11:40:29 +0000 (14:40 +0300)]
Fix a bug in the prefix version of vector compose function
Mikko Rasa [Sun, 2 Jun 2019 11:40:16 +0000 (14:40 +0300)]
Add test cases for Vector
Mikko Rasa [Sun, 2 Jun 2019 11:39:58 +0000 (14:39 +0300)]
Use numeric_limits in Matrix test cases
Mikko Rasa [Sun, 2 Jun 2019 11:29:25 +0000 (14:29 +0300)]
Add formatted output operators for vector and matrix classes
Mikko Rasa [Sat, 1 Jun 2019 21:55:40 +0000 (00:55 +0300)]
Fix a function name
The definition was changed in
fb1e198 but since everything is templates,
I didn't notice the incorrect name here.
Mikko Rasa [Sat, 1 Jun 2019 21:49:36 +0000 (00:49 +0300)]
Use correct type for constant
Mikko Rasa [Thu, 9 Nov 2017 10:45:59 +0000 (12:45 +0200)]
Add row and column accessors to Matrix
Mikko Rasa [Thu, 9 Nov 2017 10:07:20 +0000 (12:07 +0200)]
Rename the low-level matrix inversion function to gauss_jordan
Since that's the name of the algorithm being used. Also remove an
unnecessary assignment from the non-mutating case.
Mikko Rasa [Tue, 18 Apr 2017 11:16:45 +0000 (14:16 +0300)]
Optimize bounding box bisection with more early culling
Mikko Rasa [Tue, 18 Apr 2017 06:37:35 +0000 (09:37 +0300)]
Add some comments to shape.h
Mikko Rasa [Tue, 18 Apr 2017 06:10:55 +0000 (09:10 +0300)]
Use the coverage function to calculate tighter bounding boxes
Mikko Rasa [Tue, 18 Apr 2017 06:04:02 +0000 (09:04 +0300)]
Add a function to test whether a shapes covers a bounding box
Mikko Rasa [Mon, 17 Apr 2017 19:27:29 +0000 (22:27 +0300)]
Fix composite shape ray intersection logic
The test for start_nesting coalescence was written the wrong way, causing
intersection shapes to return spurious hits when the ray started inside
some part of the shape. Presumably union shapes did not return hits in
some cases when they should.
Mikko Rasa [Fri, 6 Jan 2017 12:46:51 +0000 (14:46 +0200)]
Use correct class to refer to member function
Mikko Rasa [Fri, 6 Jan 2017 02:57:08 +0000 (04:57 +0200)]
Add a missing include
Mikko Rasa [Fri, 16 Sep 2016 22:38:05 +0000 (01:38 +0300)]
Use numeric literals in place of M_PI
Recent Windows headers require _USE_MATH_DEFINES to be #defined in order
to #define M_PI, but we can't guarantee that someone else won't #include
<cmath> before us.
Mikko Rasa [Thu, 1 Sep 2016 13:33:30 +0000 (16:33 +0300)]
Avoid a warning about shadowing a member
Mikko Rasa [Sun, 28 Aug 2016 23:57:09 +0000 (02:57 +0300)]
Add dynamically allocated versions of matrix and vector
Sometimes it's not possible to know the dimensions at compile time, for
example when calculating regressions from user-inputted data.
Mikko Rasa [Fri, 19 Aug 2016 23:24:20 +0000 (02:24 +0300)]
Adjust start_nesting in CompositeShape::get_intersections
The intersection points are coalesced to incrementally form a single
composite shape so start_nesting must follow suit.
Mikko Rasa [Sat, 2 Jul 2016 17:00:50 +0000 (20:00 +0300)]
Ensure that HyperBox does not produce duplicate intersections
In certain corner cases (literally) two coincident intersections could be
produced when the ray passed through the edge of the box, preventing
intersctions on the opposite side from being produced.
Mikko Rasa [Sat, 2 Jul 2016 16:58:44 +0000 (19:58 +0300)]
Use the proper array size in the raytrace example
Mikko Rasa [Sat, 2 Jul 2016 15:36:04 +0000 (18:36 +0300)]
Minor fixes
Mikko Rasa [Sat, 2 Jul 2016 15:34:13 +0000 (18:34 +0300)]
Rework CompositeShape algorithms
The old version had problems with coplanar surfaces and sometimes failed
to produce intersections when it should have.
Mikko Rasa [Sat, 2 Jul 2016 15:06:27 +0000 (18:06 +0300)]
Add an entry flag to SharedPoint
Mikko Rasa [Wed, 10 Feb 2016 15:24:44 +0000 (17:24 +0200)]
Remove a debug print
Mikko Rasa [Wed, 10 Feb 2016 15:20:48 +0000 (17:20 +0200)]
Fix the name of the properties panel
Mikko Rasa [Tue, 9 Feb 2016 15:04:50 +0000 (17:04 +0200)]
Add a Blender operator to export shapes
Mikko Rasa [Fri, 4 Dec 2015 11:05:23 +0000 (13:05 +0200)]
Correct a spelling mistake
Mikko Rasa [Fri, 4 Dec 2015 11:04:38 +0000 (13:04 +0200)]
Add a forgotten & to a getter
Mikko Rasa [Wed, 10 Dec 2014 18:32:47 +0000 (20:32 +0200)]
Fix the bounding sphere algorithm
Mikko Rasa [Sat, 22 Nov 2014 09:47:59 +0000 (11:47 +0200)]
Add missing #includes to dummy.cpp
Mikko Rasa [Sat, 22 Nov 2014 09:47:41 +0000 (11:47 +0200)]
Comment tweaks
Mikko Rasa [Sat, 22 Nov 2014 09:41:13 +0000 (11:41 +0200)]
Avoid division by zero in HalfSpace::get_intersections
Mikko Rasa [Sat, 22 Nov 2014 09:35:31 +0000 (11:35 +0200)]
Always explicitly construct values of type T
Mikko Rasa [Sat, 22 Nov 2014 09:18:34 +0000 (11:18 +0200)]
Add a raytracer example program
Mikko Rasa [Sat, 22 Nov 2014 09:15:15 +0000 (11:15 +0200)]
Add a loading system for shapes
Mikko Rasa [Fri, 21 Nov 2014 12:38:55 +0000 (14:38 +0200)]
Convert the geometry part to use the new vector slicing API
Everything being templates makes catching subtle compilation errors a bit
hard.
Mikko Rasa [Thu, 13 Nov 2014 21:18:47 +0000 (23:18 +0200)]
Clearer API for slicing and dicing vectors, and also matrices
Mikko Rasa [Fri, 31 Oct 2014 08:08:04 +0000 (10:08 +0200)]
Always pivot rows when inverting for better numerical stability
Mikko Rasa [Wed, 15 Oct 2014 21:04:53 +0000 (00:04 +0300)]
Add an empty flag to BoundingSphere
Useful for distinguishing a bounding sphere that has nothing in it from
one that contains a single point.
Mikko Rasa [Wed, 11 Sep 2013 07:15:02 +0000 (10:15 +0300)]
Add a bounding sphere class
Shapes don't produce bounding spheres yet, but it can be used for other
purposes.
Mikko Rasa [Thu, 5 Sep 2013 15:24:19 +0000 (18:24 +0300)]
Add missing return statements
Mikko Rasa [Sat, 25 May 2013 23:14:45 +0000 (02:14 +0300)]
Negation contains a pointer and needs copy c'tor and operator=
Mikko Rasa [Fri, 24 May 2013 06:06:29 +0000 (09:06 +0300)]
Put ray and bounding box transformations in AffineTransformation
This makes them easier to use elsewhere, in cases where creating a
TransformedShape would be overkill.
Mikko Rasa [Thu, 23 May 2013 19:26:28 +0000 (22:26 +0300)]
Take care not to count initialization values when finding min/max
Mikko Rasa [Thu, 23 May 2013 09:12:54 +0000 (12:12 +0300)]
Add testcases for BoundingBox
Mikko Rasa [Thu, 23 May 2013 09:01:07 +0000 (12:01 +0300)]
Some bounding box logic fixes
Mikko Rasa [Wed, 22 May 2013 20:03:07 +0000 (23:03 +0300)]
Make CompositeShape::get_intersections work with null points
This was a bit tricky, since it's necessary to inspect the points returned
by component shapes to see if they're actually on the composite surface.
To that end, a temporary buffer is allocated. This is most likely used in
interactive point-and-pick situations, so the performance loss should not
be significant.
Mikko Rasa [Wed, 22 May 2013 20:02:00 +0000 (23:02 +0300)]
Implement the missing assignment operator in CompositeShape
Also rewrite the copy constructor in a slightly different way.
Mikko Rasa [Wed, 22 May 2013 19:56:21 +0000 (22:56 +0300)]
Put the common #includes in shape.h
Almost every shape needs these, so it's not worth it to try and avoid
unnecessary headers in the base class.
Mikko Rasa [Wed, 22 May 2013 19:48:45 +0000 (22:48 +0300)]
Fix a case in ExtrudedShape with certain ray parameters
A ray starting outside of the length of the shape and pointing away from
it caused a local ray with a negative limit to be constructed.
Mikko Rasa [Wed, 22 May 2013 17:34:01 +0000 (20:34 +0300)]
Implement bounding boxes with a separate class
This solves several problems with them, including positioning off the
origin and bounding boxes of negated shapes.
Mikko Rasa [Wed, 22 May 2013 13:14:16 +0000 (16:14 +0300)]
Rewrite composite shape vector constructors with iterator ranges
Besides the issue of favoring one container type over others, constness
of the contents causes it to be a different, incompatible type. Iterators
solve this in an elegant way.
Mikko Rasa [Wed, 22 May 2013 12:31:57 +0000 (15:31 +0300)]
Add a HalfSpace shape
Mikko Rasa [Tue, 21 May 2013 18:41:15 +0000 (21:41 +0300)]
Make the check_intersection function non-virtual
Almost all shapes were implementing it with a call to get_intersections,
so might as well make the base class do that. Performance loss is likely
negligible.
Mikko Rasa [Tue, 21 May 2013 17:53:09 +0000 (20:53 +0300)]
Properly sort intersection points for complex shapes
Code structure in simpler shapes have been adjusted to keep it similar.