@eturnity/eturnity_maths
Advanced tools
Comparing version 6.42.0 to 6.42.1-EPDM-7379.0
{ | ||
"name": "@eturnity/eturnity_maths", | ||
"version": "6.42.0", | ||
"version": "6.42.1-EPDM-7379.0", | ||
"author": "Eturnity Team", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -13,2 +13,3 @@ import { | ||
normalizeVector} from './vector' | ||
import {inverse3x3matrix,multiplyMatrices} from './matrix' | ||
import {Point} from './objects/Point' | ||
@@ -95,2 +96,19 @@ import {Line} from './objects/Line' | ||
} | ||
export function getDataAboutTwo3DLines(A,u,B,v){ | ||
let w=crossProduct(u,v) | ||
let m=[ | ||
[u.x,v.x,w.x], | ||
[u.y,v.y,w.y], | ||
[u.z,v.z,w.z] | ||
] | ||
let mInv=inverse3x3matrix(m) | ||
let AB=substractVector(B,A) | ||
let [t1,t2,t3] = multiplyMatrices(mInv,[[AB.x],[AB.y],[AB.z]]) | ||
let M=addVector(A,multiplyVector(t1,u)) | ||
let N=addVector(B,multiplyVector(t2,v)) | ||
let distance=get3DDistanceBetweenPoints(M,N) | ||
return {m,mInv,M,N,A,B,u,v,w,distance,t1,t2,t3} | ||
} | ||
export function vectorFromAngleInDegCanvas(angle) { | ||
@@ -109,2 +127,3 @@ return { | ||
} | ||
export function get3DDistanceBetweenPoints(firstPoint, secondPoint) { | ||
@@ -149,2 +168,5 @@ const distance = Math.hypot( | ||
} | ||
export function isAlmostSamePoint3D(A, B, tolerance) { | ||
return Math.abs(A.x - B.x) < tolerance && Math.abs(A.y - B.y) < tolerance && Math.abs(A.z - B.z) < tolerance | ||
} | ||
export function isSamePoint2D(A, B) { | ||
@@ -179,2 +201,11 @@ return A.x == B.x && A.y == B.y | ||
} | ||
export function isAlmostSameSegment3D(seg_0, seg_1, tolerance) { | ||
let check_1 = | ||
isAlmostSamePoint3D(seg_0[0], seg_1[0], tolerance) && | ||
isAlmostSamePoint3D(seg_0[1], seg_1[1], tolerance) | ||
let check_2 = | ||
isAlmostSamePoint3D(seg_0[0], seg_1[1], tolerance) && | ||
isAlmostSamePoint3D(seg_0[1], seg_1[0], tolerance) | ||
return check_1 || check_2 | ||
} | ||
export function isSameLine(AB, CD) { | ||
@@ -608,3 +639,9 @@ if (!AB || !CD) { | ||
} | ||
export function normalVectorWithDirectionAndIncline(direction,incline){ | ||
return { | ||
x:Math.sin(direction*Math.PI/180)*Math.sin(incline*Math.PI/180), | ||
y:Math.cos(direction*Math.PI/180)*Math.sin(incline*Math.PI/180), | ||
z:Math.cos(incline*Math.PI/180) | ||
} | ||
} | ||
export function inclineWithNormalVector(normalVector) { | ||
@@ -611,0 +648,0 @@ const angleRad = Math.acos(dotProduct(normalVector, { x: 0, y: 0, z: 1 })) |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
104157
3234
2