Skip to content

Feat: Add vector functions #69

Description

@Arman2409
// Vector math operations
vector.normalize(point: Point): Point
vector.magnitude(point: Point): number
vector.dot(point1: Point, point2: Point): number
vector.cross2D(point1: Point, point2: Point): number  // Returns scalar in 2D
vector.lerp(point1: Point, point2: Point, t: number): Point  // Linear interpolation
vector.project(point: Point, onto: Point): Point
vector.reflect(point: Point, normal: Point): Point
vector.perpendicular(point: Point): Point  // Returns 90° rotated vector

// Utility
vector.equals(point1: Point, point2: Point, epsilon?: number): boolean
vector.isZero(point: Point, epsilon?: number): boolean

Other ideas

// Vector math operations
vector.normalize(point: Point): Point
vector.magnitude(point: Point): number
vector.dot(point1: Point, point2: Point): number
vector.cross2D(point1: Point, point2: Point): number  // Returns scalar in 2D
vector.lerp(point1: Point, point2: Point, t: number): Point  // Linear interpolation
vector.project(point: Point, onto: Point): Point
vector.reflect(point: Point, normal: Point): Point
vector.perpendicular(point: Point): Point  // Returns 90° rotated vector

// Utility
vector.equals(point1: Point, point2: Point, epsilon?: number): boolean
vector.isZero(point: Point, epsilon?: number): boolean

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions