-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
15 additions
and
15 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
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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import { Quaternion, Vector3 } from '@dcl/sdk/math' | ||
|
||
export function rotateVectorAroundCenter(vec: Vector3, vecCenter: Vector3, rot: Quaternion){ | ||
let vecResult = Vector3.subtract(vec, vecCenter) | ||
vecResult = Vector3.rotate(vecResult, rot) | ||
vecResult = Vector3.add(vecResult, vecCenter) | ||
export function rotateVectorAroundCenter(vec: Vector3, vecCenter: Vector3, rot: Quaternion) { | ||
let vecResult = Vector3.subtract(vec, vecCenter) | ||
vecResult = Vector3.rotate(vecResult, rot) | ||
vecResult = Vector3.add(vecResult, vecCenter) | ||
|
||
return vecResult | ||
return vecResult | ||
} | ||
|
||
export function isVectorInsideArea(vec: Vector3, areaPt1: Vector3, areaPt2: Vector3){ | ||
let minX = Math.min(areaPt1.x, areaPt2.x) | ||
let maxX = Math.max(areaPt1.x, areaPt2.x) | ||
export function isVectorInsideArea(vec: Vector3, areaPt1: Vector3, areaPt2: Vector3) { | ||
const minX = Math.min(areaPt1.x, areaPt2.x) | ||
const maxX = Math.max(areaPt1.x, areaPt2.x) | ||
|
||
let minZ = Math.min(areaPt1.z, areaPt2.z) | ||
let maxZ = Math.max(areaPt1.z, areaPt2.z) | ||
const minZ = Math.min(areaPt1.z, areaPt2.z) | ||
const maxZ = Math.max(areaPt1.z, areaPt2.z) | ||
|
||
return vec.x > minX && vec.x < maxX && vec.z > minZ && vec.z < maxZ | ||
return vec.x > minX && vec.x < maxX && vec.z > minZ && vec.z < maxZ | ||
} |