Moar code that i didnt commit and push like a fucking moron - doing this remotely from orion
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
export namespace Physis {
|
||||||
|
export class Engine {}
|
||||||
|
}
|
||||||
@@ -1,25 +1,24 @@
|
|||||||
import Vector2 from "$lib/vector";
|
import Vector2 from '$lib/vector';
|
||||||
import Rigidbody2D from "../rigidbody/rigidbody2d";
|
import Rigidbody2D from '../rigidbody/rigidbody2d';
|
||||||
|
|
||||||
class AABB {
|
export class AABB {
|
||||||
private size: Vector2 = new Vector2();
|
private size: Vector2 = new Vector2();
|
||||||
private halfSize: Vector2 = new Vector2();
|
private halfSize: Vector2 = new Vector2();
|
||||||
private rigidbody: Rigidbody2D | null = null;
|
private rigidbody: Rigidbody2D | null = null;
|
||||||
|
|
||||||
constructor(min?: Vector2, max?: Vector2) {
|
constructor(min?: Vector2, max?: Vector2) {
|
||||||
if(min !== undefined && max !== undefined)
|
if (min !== undefined && max !== undefined) this.size = new Vector2(max).sub(min);
|
||||||
this.size = new Vector2(max).sub(min);
|
|
||||||
|
|
||||||
this.halfSize = new Vector2(this.size.mul(0.5));
|
this.halfSize = new Vector2(this.size.mul(0.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
public get getMin(): Vector2 {
|
public get getMin(): Vector2 {
|
||||||
return new Vector2(this.rigidbody.getPosition).sub(this.halfSize);
|
return new Vector2(this.rigidbody.Position).sub(this.halfSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get getMax(): Vector2 {
|
public get getMax(): Vector2 {
|
||||||
return new Vector2(this.rigidbody.getPosition).add(this.halfSize);
|
return new Vector2(this.rigidbody.Position).add(this.halfSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AABB;
|
export default AABB;
|
||||||
|
|||||||
@@ -1,50 +1,49 @@
|
|||||||
import Vector2 from "$lib/vector"
|
import Vector2 from '$lib/vector';
|
||||||
import type Rigidbody2D from "../rigidbody/rigidbody2d";
|
import type Rigidbody2D from '../rigidbody/rigidbody2d';
|
||||||
|
|
||||||
class Box2D {
|
export class Box2D {
|
||||||
private size: Vector2 = new Vector2();
|
private size: Vector2 = new Vector2();
|
||||||
private halfSize: Vector2 = new Vector2();
|
private halfSize: Vector2 = new Vector2();
|
||||||
private rigidbody: Rigidbody2D | null = null;
|
private rigidbody: Rigidbody2D | null = null;
|
||||||
|
|
||||||
constructor();
|
constructor();
|
||||||
constructor(min?: Vector2, max?: Vector2) {
|
constructor(min?: Vector2, max?: Vector2) {
|
||||||
if(min !== undefined && max !== undefined)
|
if (min !== undefined && max !== undefined) this.size = new Vector2(max).sub(min);
|
||||||
this.size = new Vector2(max).sub(min);
|
|
||||||
|
|
||||||
this.halfSize = new Vector2(this.size.mul(0.5));
|
|
||||||
}
|
|
||||||
|
|
||||||
public get getMin(): Vector2 {
|
this.halfSize = new Vector2(this.size.mul(0.5));
|
||||||
return new Vector2(this.rigidbody.getPosition).sub(this.halfSize);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get getMax(): Vector2 {
|
public get getMin(): Vector2 {
|
||||||
return new Vector2(this.rigidbody.getPosition).add(this.halfSize);
|
return new Vector2(this.rigidbody.Position).sub(this.halfSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get getVectices(): Vector2[] {
|
public get getMax(): Vector2 {
|
||||||
const min: Vector2 = this.getMin;
|
return new Vector2(this.rigidbody.Position).add(this.halfSize);
|
||||||
const max: Vector2 = this.getMax;
|
}
|
||||||
|
|
||||||
const vertices: Vector2[] = [
|
public get getVectices(): Vector2[] {
|
||||||
new Vector2(min.x, min.y),
|
const min: Vector2 = this.getMin;
|
||||||
new Vector2(min.x, max.y),
|
const max: Vector2 = this.getMax;
|
||||||
new Vector2(max.x, min.y),
|
|
||||||
new Vector2(max.x, max.y)
|
|
||||||
];
|
|
||||||
|
|
||||||
if(this.rigidbody.getRotation != 0.00) {
|
const vertices: Vector2[] = [
|
||||||
for(const vert of vertices) {
|
new Vector2(min.x, min.y),
|
||||||
//TODO Rotate Vert around this.rigidbody.getPosition by this.rigidbody.getRotation;
|
new Vector2(min.x, max.y),
|
||||||
}
|
new Vector2(max.x, min.y),
|
||||||
}
|
new Vector2(max.x, max.y)
|
||||||
|
];
|
||||||
|
|
||||||
return vertices;
|
if (this.rigidbody.Rotation != 0.0) {
|
||||||
}
|
for (const vert of vertices) {
|
||||||
|
//TODO Rotate Vert around this.rigidbody.getPosition by this.rigidbody.getRotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public get getRigidbody(): Rigidbody2D {
|
return vertices;
|
||||||
return this.rigidbody;
|
}
|
||||||
}
|
|
||||||
|
public get getRigidbody(): Rigidbody2D {
|
||||||
|
return this.rigidbody;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Box2D;
|
export default Box2D;
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import type Vector2 from '$lib/vector';
|
||||||
|
import type Rigidbody2D from '../rigidbody/rigidbody2d';
|
||||||
|
|
||||||
|
class Circle {
|
||||||
|
private radius: number = 1.0;
|
||||||
|
private rigidbody: Rigidbody2D;
|
||||||
|
|
||||||
|
public get Radius(): number {
|
||||||
|
return this.radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get Center(): Vector2 {
|
||||||
|
return this.rigidbody.Position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Circle;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import type Vector2 from '$lib/vector';
|
||||||
|
|
||||||
|
class Ray2D {
|
||||||
|
private origin: Vector2;
|
||||||
|
private direction: Vector2;
|
||||||
|
|
||||||
|
constructor(origin: Vector2, direction: Vector2) {
|
||||||
|
this.origin = origin;
|
||||||
|
this.direction = direction;
|
||||||
|
this.direction.normalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public get Origin(): Vector2 {
|
||||||
|
return this.origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get Direction(): Vector2 {
|
||||||
|
return this.direction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Ray2D;
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import Vector2 from '$lib/vector';
|
||||||
|
|
||||||
|
class RaycastResult {
|
||||||
|
private point: Vector2 = new Vector2();
|
||||||
|
private normal: Vector2 = new Vector2();
|
||||||
|
private t: number = -1;
|
||||||
|
private hit: boolean = false;
|
||||||
|
|
||||||
|
public init(point: Vector2, normal: Vector2, t: number, hit: boolean) {
|
||||||
|
this.point.set(point.x, point.y);
|
||||||
|
this.normal.set(normal.x, normal.y);
|
||||||
|
this.t = t;
|
||||||
|
this.hit = hit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static reset(result: RaycastResult) {
|
||||||
|
if (result != null) {
|
||||||
|
result.point.set(Vector2.zero.x, Vector2.zero.y);
|
||||||
|
result.normal.set(Vector2.zero.x, Vector2.zero.y);
|
||||||
|
result.t = -1;
|
||||||
|
result.hit = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default RaycastResult;
|
||||||
@@ -1,79 +1,183 @@
|
|||||||
import Line2D from "$lib/shimeji/renderer/line2d";
|
import Line2D from '$lib/shimeji/renderer/line2d';
|
||||||
import Vector2 from "$lib/vector";
|
import Vector2 from '$lib/vector';
|
||||||
import VMath from "$lib/vmath";
|
import VMath from '$lib/vmath';
|
||||||
import AABB from "../primitives/aabb";
|
import AABB from '../primitives/aabb';
|
||||||
import type Box2D from "../primitives/box2d";
|
import Box2D from '../primitives/box2d';
|
||||||
|
import Circle from '../primitives/circle';
|
||||||
|
import type Ray2D from '../primitives/ray2d';
|
||||||
|
import RaycastResult from '../primitives/raycast_result';
|
||||||
|
|
||||||
class IntersectionDetector2D {
|
class IntersectionDetector2D {
|
||||||
|
public static pointOnLine(point: Vector2, line: Line2D): boolean {
|
||||||
public static pointOnLine(point: Vector2, line: Line2D): boolean {
|
let dy: number = line.getEnd().y - line.getStart().y;
|
||||||
let dy: number = line.getEnd.y - line.getStart.y;
|
let dx: number = line.getEnd().x - line.getStart().x;
|
||||||
let dx: number = line.getEnd.x - line.getStart.x;
|
let m: number = dy / dx;
|
||||||
let m: number = dy / dx;
|
|
||||||
|
|
||||||
let b = line.getEnd.y - (m * line.getEnd.x);
|
let b = line.getEnd().y - m * line.getEnd().x;
|
||||||
|
|
||||||
//Check the line equation
|
|
||||||
return point.y == m * point.x + b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static pointInAABB(point: Vector2, aabb: AABB): boolean {
|
//Check the line equation
|
||||||
let min: Vector2 = aabb.getMin;
|
return point.y == m * point.x + b;
|
||||||
let max: Vector2 = aabb.getMax;
|
}
|
||||||
|
|
||||||
return point.x <= max.x && point.x >= min.x &&
|
public static pointInCircle(point: Vector2, circle: Circle) {
|
||||||
point.y >= min.y && point.y <= max.y;
|
const circleCenter: Vector2 = circle.Center;
|
||||||
}
|
const centerToPoint: Vector2 = new Vector2(point).sub(circleCenter);
|
||||||
|
|
||||||
public static pointInBox2D(point: Vector2, box: Box2D): boolean {
|
return centerToPoint.sqrLength <= circle.Radius * circle.Radius;
|
||||||
const pointLocal = new Vector2(point);
|
}
|
||||||
VMath.rotate(pointLocal, box.getRigidbody.getRotation, box.getRigidbody.getPosition);
|
|
||||||
|
|
||||||
let min: Vector2 = box.getMin;
|
public static pointInAABB(point: Vector2, aabb: AABB): boolean {
|
||||||
let max: Vector2 = box.getMax;
|
let min: Vector2 = aabb.getMin;
|
||||||
|
let max: Vector2 = aabb.getMax;
|
||||||
|
|
||||||
return pointLocal.x <= max.x && pointLocal.x >= min.x &&
|
return point.x <= max.x && point.x >= min.x && point.y >= min.y && point.y <= max.y;
|
||||||
pointLocal.y >= min.y && pointLocal.y <= max.y;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static lineAndAABB(line: Line2D, box: AABB): boolean {
|
public static pointInBox2D(point: Vector2, box: Box2D): boolean {
|
||||||
if(this.pointInAABB(line.getStart, box) || this.pointInAABB(line.getEnd, box))
|
const pointLocal = new Vector2(point);
|
||||||
return true;
|
VMath.rotate(pointLocal, box.getRigidbody.Rotation, box.getRigidbody.Position);
|
||||||
|
|
||||||
let uVec: Vector2 = new Vector2(line.getEnd).sub(line.getStart);
|
let min: Vector2 = box.getMin;
|
||||||
uVec.normalize;
|
let max: Vector2 = box.getMax;
|
||||||
|
|
||||||
uVec.x = (!uVec.equals(Vector2.zero)) ? 1.0 / uVec.x : 0.0;
|
return (
|
||||||
uVec.y = (!uVec.equals(Vector2.zero)) ? 1.0 / uVec.y : 0.0;
|
pointLocal.x <= max.x &&
|
||||||
|
pointLocal.x >= min.x &&
|
||||||
|
pointLocal.y >= min.y &&
|
||||||
|
pointLocal.y <= max.y
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const min: Vector2 = box.getMin;
|
public static lineAndCircle(line: Line2D, circle: Circle): boolean {
|
||||||
min.sub(line.getStart).mul(uVec);
|
if (this.pointInCircle(line.getStart(), circle) || this.pointInCircle(line.getEnd(), circle))
|
||||||
const max: Vector2 = box.getMax;
|
return true;
|
||||||
max.sub(line.getStart).mul(uVec);
|
|
||||||
|
|
||||||
const tmin: number = Math.max(Math.min(min.x, max.x), Math.min(min.y, max.y));
|
const ab: Vector2 = new Vector2(line.getEnd()).sub(line.getStart());
|
||||||
const tmax: number = Math.min(Math.max(min.x, max.x), Math.max(min.y, max.y));
|
|
||||||
|
|
||||||
if(tmax < 0 || tmin > tmax) {
|
const circleCenter: Vector2 = circle.Center;
|
||||||
return false;
|
const centerToLineStart: Vector2 = new Vector2(circleCenter).sub(line.getStart());
|
||||||
}
|
const t: number = centerToLineStart.dot(ab) / ab.dot(ab);
|
||||||
|
|
||||||
const t = (tmin < 0) ? tmax : tmin;
|
|
||||||
return t > 0 && t * t < line.lengthSquared();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static lineAndBox2D(line: Line2D, box: Box2D): boolean {
|
if (t < 0.0 || t > 1.0) return false;
|
||||||
const rotation: number = box.getRigidbody.getRotation;
|
|
||||||
const center: Vector2 = box.getRigidbody.getPosition;
|
|
||||||
const localStart: Vector2 = new Vector2(line.getStart);
|
|
||||||
const localEnd: Vector2 = new Vector2(line.getEnd);
|
|
||||||
|
|
||||||
VMath.rotate(localStart, rotation, center);
|
const closestPoint: Vector2 = new Vector2(line.getStart()).add(ab.mul(t));
|
||||||
VMath.rotate(localEnd, rotation, center);
|
|
||||||
|
|
||||||
const localLine: Line2D = new Line2D(localStart, localEnd);
|
return this.pointInCircle(closestPoint, circle);
|
||||||
const aabb: AABB = new AABB(box.getMin, box.getMax);
|
}
|
||||||
|
|
||||||
return this.lineAndAABB(localLine, aabb);
|
public static lineAndAABB(line: Line2D, box: AABB): boolean {
|
||||||
}
|
if (this.pointInAABB(line.getStart(), box) || this.pointInAABB(line.getEnd(), box)) return true;
|
||||||
}
|
|
||||||
|
let uVec: Vector2 = new Vector2(line.getEnd()).sub(line.getStart());
|
||||||
|
uVec.normalize;
|
||||||
|
|
||||||
|
uVec.x = !uVec.equals(Vector2.zero) ? 1.0 / uVec.x : 0.0;
|
||||||
|
uVec.y = !uVec.equals(Vector2.zero) ? 1.0 / uVec.y : 0.0;
|
||||||
|
|
||||||
|
const min: Vector2 = box.getMin;
|
||||||
|
min.sub(line.getStart()).mul(uVec);
|
||||||
|
const max: Vector2 = box.getMax;
|
||||||
|
max.sub(line.getStart()).mul(uVec);
|
||||||
|
|
||||||
|
const tmin: number = Math.max(Math.min(min.x, max.x), Math.min(min.y, max.y));
|
||||||
|
const tmax: number = Math.min(Math.max(min.x, max.x), Math.max(min.y, max.y));
|
||||||
|
|
||||||
|
if (tmax < 0 || tmin > tmax) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const t = tmin < 0 ? tmax : tmin;
|
||||||
|
return t > 0 && t * t < line.lengthSqr();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static lineAndBox2D(line: Line2D, box: Box2D): boolean {
|
||||||
|
const rotation: number = box.getRigidbody.Rotation;
|
||||||
|
const center: Vector2 = box.getRigidbody.Position;
|
||||||
|
const localStart: Vector2 = new Vector2(line.getStart());
|
||||||
|
const localEnd: Vector2 = new Vector2(line.getEnd());
|
||||||
|
|
||||||
|
VMath.rotate(localStart, rotation, center);
|
||||||
|
VMath.rotate(localEnd, rotation, center);
|
||||||
|
|
||||||
|
const localLine: Line2D = new Line2D(localStart, localEnd);
|
||||||
|
const aabb: AABB = new AABB(box.getMin, box.getMax);
|
||||||
|
|
||||||
|
return this.lineAndAABB(localLine, aabb);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static raycast(circle: Circle, ray: Ray2D, result: RaycastResult): boolean;
|
||||||
|
public static raycast(aabb: AABB, ray: Ray2D, result: RaycastResult): boolean;
|
||||||
|
public static raycast(box: Box2D, ray: Ray2D, result: RaycastResult): boolean;
|
||||||
|
public static raycast(
|
||||||
|
primitive: Circle | AABB | Box2D,
|
||||||
|
ray: Ray2D,
|
||||||
|
result: RaycastResult
|
||||||
|
): boolean {
|
||||||
|
if (primitive instanceof Circle) {
|
||||||
|
RaycastResult.reset(result);
|
||||||
|
|
||||||
|
const originToCircle: Vector2 = new Vector2(primitive.Center).sub(ray.Origin);
|
||||||
|
const radiusSqr: number = primitive.Radius * primitive.Radius;
|
||||||
|
const originToCircleSqr: number = originToCircle.sqrLength;
|
||||||
|
|
||||||
|
const a: number = originToCircle.dot(ray.Direction);
|
||||||
|
const bSqr: number = originToCircleSqr - a * a;
|
||||||
|
|
||||||
|
if (radiusSqr - bSqr < 0.0) return false;
|
||||||
|
|
||||||
|
const f: number = Math.sqrt(radiusSqr - bSqr);
|
||||||
|
let t: number = 0;
|
||||||
|
if (originToCircleSqr < radiusSqr) {
|
||||||
|
t = a + f;
|
||||||
|
} else {
|
||||||
|
t = a - f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
const point: Vector2 = new Vector2(ray.Origin).add(new Vector2(ray.Direction)).mul(t);
|
||||||
|
const normal: Vector2 = new Vector2(point).sub(primitive.Center);
|
||||||
|
normal.normalize();
|
||||||
|
|
||||||
|
result.init(point, normal, t, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else if (primitive instanceof AABB) {
|
||||||
|
RaycastResult.reset(result);
|
||||||
|
let uVec: Vector2 = ray.Direction;
|
||||||
|
uVec.normalize;
|
||||||
|
|
||||||
|
uVec.x = !uVec.equals(Vector2.zero) ? 1.0 / uVec.x : 0.0;
|
||||||
|
uVec.y = !uVec.equals(Vector2.zero) ? 1.0 / uVec.y : 0.0;
|
||||||
|
|
||||||
|
const min: Vector2 = primitive.getMin;
|
||||||
|
min.sub(ray.Origin).mul(uVec);
|
||||||
|
const max: Vector2 = primitive.getMax;
|
||||||
|
max.sub(ray.Origin).mul(uVec);
|
||||||
|
|
||||||
|
const tmin: number = Math.max(Math.min(min.x, max.x), Math.min(min.y, max.y));
|
||||||
|
const tmax: number = Math.min(Math.max(min.x, max.x), Math.max(min.y, max.y));
|
||||||
|
|
||||||
|
if (tmax < 0 || tmin > tmax) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const t = tmin < 0 ? tmax : tmin;
|
||||||
|
const hit: boolean = t > 0; //&& t * t < ray.Distance;
|
||||||
|
if (!hit) return false;
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
const point: Vector2 = new Vector2(ray.Origin).add(new Vector2(ray.Direction).mul(t));
|
||||||
|
const normal: Vector2 = new Vector2(ray.Origin).sub(point);
|
||||||
|
normal.normalize();
|
||||||
|
|
||||||
|
result.init(point, normal, t, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
//TODO: Box2D implementation
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,25 +1,24 @@
|
|||||||
import Vector2 from "$lib/vector";
|
import Vector2 from '$lib/vector';
|
||||||
|
|
||||||
class Rigidbody2D {
|
class Rigidbody2D {
|
||||||
private position: Vector2 = new Vector2();
|
private position: Vector2 = new Vector2();
|
||||||
private rotation: number = 0.0;
|
private rotation: number = 0.0;
|
||||||
|
|
||||||
public get getPosition(): Vector2 {
|
public get Position(): Vector2 {
|
||||||
return this.position;
|
return this.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public set setPosition(position: Vector2) {
|
public set setPosition(position: Vector2) {
|
||||||
this.position = position;
|
this.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get getRotation(): number {
|
public get Rotation(): number {
|
||||||
return this.rotation;
|
return this.rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public set setRotation(rotation: number) {
|
|
||||||
this.rotation = rotation
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public set setRotation(rotation: number) {
|
||||||
|
this.rotation = rotation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Rigidbody2D;
|
export default Rigidbody2D;
|
||||||
|
|||||||
@@ -1,27 +1,25 @@
|
|||||||
import Vector2 from "$lib/vector";
|
import Vector2 from '$lib/vector';
|
||||||
|
|
||||||
class Line2D {
|
class Line2D {
|
||||||
private from: Vector2;
|
private from: Vector2;
|
||||||
private to: Vector2;
|
private to: Vector2;
|
||||||
|
|
||||||
|
constructor(from: Vector2, to: Vector2) {
|
||||||
|
this.from = from;
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(from: Vector2, to: Vector2) {
|
public getStart(): Vector2 {
|
||||||
this.from = from;
|
return this.from;
|
||||||
this.to = to;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get getStart(): Vector2 {
|
public getEnd(): Vector2 {
|
||||||
return this.from;
|
return this.to;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get getEnd(): Vector2 {
|
|
||||||
return this.to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public lengthSquared(): number {
|
|
||||||
return new Vector2(this.to).sub(this.from).sqrLength
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public lengthSqr(): number {
|
||||||
|
return new Vector2(this.to).sub(this.from).sqrLength;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Line2D;
|
export default Line2D;
|
||||||
|
|||||||
Reference in New Issue
Block a user