homography-transform
Version:
A robust TypeScript implementation of homography-based transformation between 2D planes, ideal for computer vision and image mapping
25 lines (24 loc) • 593 B
JavaScript
export class Plane {
constructor(width, height) {
this.width = width;
this.height = height;
if (width <= 0 || height <= 0) {
throw new Error('Plane dimensions must be positive numbers');
}
}
getWidth() {
return this.width;
}
getHeight() {
return this.height;
}
isPointInBounds(point) {
return (point.x >= 0 &&
point.x <= this.width &&
point.y >= 0 &&
point.y <= this.height);
}
toString() {
return `Plane(${this.width}x${this.height})`;
}
}