-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 2.4
- Loading branch information
Showing
50 changed files
with
1,311 additions
and
688 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ node_js: | |
- 10 | ||
- 12 | ||
- lts/* | ||
branches: | ||
only: | ||
- main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// affineplane.plane3.getNormal(plane) | ||
// | ||
// Get a unit vector perpendicular to the plane. | ||
// | ||
// Parameters: | ||
// plane | ||
// a plane3 on the reference plane | ||
// | ||
// Return: | ||
// a vec3, the plane normal vector. | ||
// | ||
module.exports = function (plane) { | ||
// Because all planes are on xy, there is one | ||
// normal vector shared by all the planes. | ||
return { x: 0, y: 0, z: 1 } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module.exports = (vec, divisor) => { | ||
// affineplane.vec2.divide(vec, divisor) | ||
// | ||
// The division of a vector. | ||
// Equivalent to multiplying the vector by the inverse of the divisor. | ||
// The direction of the vector does not change. | ||
// | ||
// Parameters: | ||
// vec | ||
// a vec2 | ||
// divisor | ||
// a number | ||
// | ||
// Return | ||
// a vec2 | ||
// | ||
// Throws: | ||
// if zero divisor | ||
// | ||
|
||
if (divisor === 0) { | ||
throw new Error('Cannot divide vector by zero. Vectors must be finite.') | ||
} | ||
return { | ||
x: vec.x / divisor, | ||
y: vec.y / divisor | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const magnitude = require('./magnitude') | ||
|
||
module.exports = (v) => { | ||
// affineplane.vec2.unit(v) | ||
// affineplane.vec2.normalize | ||
// | ||
// Get unit vector parallel to the given vector. | ||
// The magnitude of unit vector is equal to one. | ||
// If zero vector is given, assume direction towards positive x. | ||
// | ||
// Parameters: | ||
// v | ||
// a vec2 | ||
// | ||
// Return | ||
// a vec2, magnitude of one. | ||
// | ||
const m = magnitude(v) | ||
|
||
if (m > 0) { | ||
return { | ||
x: v.x / m, | ||
y: v.y / m | ||
} | ||
} | ||
return { | ||
x: 1, | ||
y: 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = (vec, divisor) => { | ||
// affineplane.vec3.divide(vec, divisor) | ||
// | ||
// The division of a vector. | ||
// Equivalent to multiplying the vector by the inverse of the divisor. | ||
// The direction of the vector does not change. | ||
// | ||
// Parameters: | ||
// vec | ||
// a vec3 | ||
// divisor | ||
// a number. If zero, will result a vector having infinite length. | ||
// | ||
// Return | ||
// a vec3 | ||
// | ||
if (divisor === 0) { | ||
throw new Error('Cannot divide vector by zero. Vectors must be finite.') | ||
} | ||
return { | ||
x: vec.x / divisor, | ||
y: vec.y / divisor, | ||
z: vec.z / divisor | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.