Jackalope / jmath (public) (License: GPLv3 or later) (since 2018-10-11) (hash sha1)
C++ conxstexpr template Math library with:
- multidimensional vectors and matrices
- geometry primitives with projection, distance and intersection functions
- coordinate systems conversions
- some routines

Depends on GCE-math C++ library as git submodule.

Used with clang (version 9 or 10) and gcc (version 9).
Written with C++17.
List of commits:
Subject Hash Author Date (UTC)
changed vector to plane argument in plane distance 498b8412af406915b03f7cfa36228ae946c15baa jp.larry 2020-01-14 17:12:59
new line definitions and correct circle polygon intersection ffdc291cc19b8edcea2a33f06306dcc628d3535c jp.larry 2020-01-14 16:08:58
vector length_p2 function 8e59b70fef912432e5b9ce2299274b3d953c3116 jp.larry 2020-01-14 16:08:07
vector_base refactoring and distance,intersection functions moved to geometry header d8473eef6419504fbcc130fb1ce1f59032503a42 jp.larry 2020-01-14 00:41:30
functions to check if line out of range f54afa1443012f918cdf16483e7fb36021d1d465 jp.larry 2020-01-11 20:39:29
clusters depth slices and depth convertions a0d15a75baa2bdeef9c033c19ded7424ab29da1a jp.larry 2020-01-10 12:06:17
plane struct inherited from vector of size 4 with normal and offset 74331763aa73548b17ff91aab0d6abaa6fa0e7d8 jp.larry 2020-01-10 10:29:04
changed identation c815eb8588c6229bbf56606446e76b0a75553eee jp.larry 2020-01-10 10:28:20
sqrt function 856c393e7ba60f99bd18e524ef408f427e04fa1c jp.larry 2020-01-10 10:27:55
removed unused matrix files 1bc1e845a6a391cce90be9023fae41937dbd100d jp.larry 2020-01-07 13:55:53
frustum data type 48480173a43561e7502458579378b78591716d1c jp.larry 2020-01-07 13:53:57
different projection matrix built functions for different fov specifications (horizontal, vertical, both) 0aa5dbb5e22c616a559bb6f6d75b0313db7b3e84 jp.larry 2020-01-07 13:53:30
normal from 3 points and plane from normal and offset functions 432070f339b8c48b18c4e2dab4389dc19ffa241c jp.larry 2020-01-06 07:27:29
check if floating point when converting from degrees 75397be78960535bca1ec487221b6b46382e0724 jp.larry 2020-01-06 07:26:59
distance between 2 vectors and intersection line with plane 1620677672179226ea92affb5e3dc600cd3fa133 jp.larry 2020-01-05 03:22:56
2D vector rotate function 049eae7f349cf44bde666b66684a47c8bb4f1300 jp.larry 2020-01-01 05:09:07
removed nodiscard from matrix *= operator and removed redundant function rotate(axis) 0dea084c205202125acfe390a248be61c962d393 jp.larry 2020-01-01 03:09:48
rafactoring update, matrix multiplication now works in different way 2f2e01d80896cd96428a9c9394382e6f040f92fb jp.larry 2019-12-31 11:00:01
round_down function 672a293659a39e29be0d84f28801cf2718070f10 Jackalope 2019-12-28 03:02:03
migw warning solved 80dec7906c5fe2dc026d6774fd526df2ded049cc Jackalope 2019-12-21 10:22:55
Commit 498b8412af406915b03f7cfa36228ae946c15baa - changed vector to plane argument in plane distance
Author: jp.larry
Author date (UTC): 2020-01-14 17:12
Committer name: jp.larry
Committer date (UTC): 2020-01-14 17:12
Parent(s): ffdc291cc19b8edcea2a33f06306dcc628d3535c
Signing key:
Tree: 2ad6993ad9a61efe91a45079c86a2cb1a6fc8425
File Lines added Lines deleted
include/math/geometry.h 3 20
File include/math/geometry.h changed (mode: 100644) (index a766d49..673e606)
... ... namespace math::distance
97 97 T line_segment(const vector<2,T> &point, const line_segment<2,T> &ls) { T line_segment(const vector<2,T> &point, const line_segment<2,T> &ls) {
98 98 return distance::point(point, projection::line_segment(point, ls)); return distance::point(point, projection::line_segment(point, ls));
99 99 } }
100 /*
101 template<int D, typename T> [[nodiscard]] constexpr inline
102 T line(const vector<D,T> &point, const line_dp<D, T> &line) {
103 auto point_direction = point - line.point;
104 return dot(point_direction, line.direction);
105 }
106 template<int D, typename T> [[nodiscard]] constexpr inline
107 T line(const vector<D,T> &point, const line_2p<D, T> &line) {
108 auto line_direction = line.end - line.beg;
109 auto point_direction = point - line.beg;
110 return dot(point_direction, line_direction);
111 }
112 */
113 template<typename T> [[nodiscard]] constexpr inline
114 T plane(const vector<3,T> &plane_normal, const vector<3,T> &point) {
115 return dot(plane_normal, point);
116 }
117 100 template<typename T> [[nodiscard]] constexpr inline template<typename T> [[nodiscard]] constexpr inline
118 T plane(const vector<4,T> &plane, const vector<3,T> &point) {
119 return point_plane(plane.template part<0,3>(), point) + plane.w;
101 T plane(const math::plane<T> &plane, const vector<3,T> &point) {
102 return dot(plane.normal, point) + plane.offset;
120 103 } }
121 104 } }
122 105 namespace math::projection namespace math::projection
 
... ... namespace math::intersection
163 146 template<typename T> [[nodiscard]] constexpr inline template<typename T> [[nodiscard]] constexpr inline
164 147 vector<3,T> vector<3,T>
165 148 plane_line(const plane<T> &plane, const line_dp<3,T> &line) { plane_line(const plane<T> &plane, const line_dp<3,T> &line) {
166 float scale = (plane.offset - distance::plane(plane.normal, line.point))
149 float scale = (plane.offset - dot(plane.normal, line.point))
167 150 / dot(plane.normal, line.direction); / dot(plane.normal, line.direction);
168 151 return line.point + line.direction * scale; return line.point + line.direction * scale;
169 152 } }
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/Jackalope/jmath

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/Jackalope/jmath

Clone this repository using git:
git clone git://git.rocketgit.com/user/Jackalope/jmath

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main