jakke-graphics-ts
Version:
My common graphics utils for building my aec apps.
64 lines • 2.66 kB
TypeScript
import { Line, Vertex3d } from "../models/types/basicGeometries";
/**
* Get point on line which is distanced from given distance.
* @param line Endpoints of line.
* @param dist Distance from endpoint.
* @param fromStart When true, anchor point will be start of line. Otherwise, end of line.
* @returns {Vertex3d} Point
*/
declare function getPointOnLine(line: {
p0: Vertex3d;
p1: Vertex3d;
}, dist: number, fromStart?: boolean): Vertex3d;
/**
* Get intersection point from lines.
* @param li0 First line of lines.
* @param li1 Second line of lines.
* @param fromExtended When it's true, intersection will be calculated including extended lines of li0, li1. Otherwise, only within li0, li1 boundary.
* @returns When the intersection exists, result will be true and pt will be that point. Otherwise, result false and message will include the reason of it.
*/
declare function getIntersection(li0: Line, li1: Line, fromExtended?: boolean): {
result: boolean;
pt?: Vertex3d;
message?: string;
};
/**
* Evaluate the parameter of given line and point.
* @param p0 Start point of Line
* @param p1 End point of Line
* @param ptTest Point to test
* @returns {number|undefined}
* When the given point is on the line between endpoints, the result will be 0 ~ 1.
* When it is on the line but outside the endpoints, the result will be negative float or larger than 1.
* When it is determined that the point actually not placed on the line, it will return undefined.
*/
declare function getParameterOnLine(p0: Vertex3d, p1: Vertex3d, ptTest: Vertex3d): number;
/**
* Find foot point on line passing, which has direction as given.
* @param direction Direction of line.
* @param pt Point to foot on line.
* @returns If you set direction as zero vector, it will return origin and param as 0.
*/
declare function getFootPointOnDirection(direction: Vertex3d, pt: Vertex3d): {
pt: Vertex3d;
t: number;
} | undefined;
/**
* Find foot point on line.
* @param line Line passing two points.
* @param pt Point to foot on line.
* @returns If you set each point of the line which has almost same coordinate each other, it will return origin and param as 0.
*/
declare function getFootPointOnLine(line: Line, pt: Vertex3d): {
pt: Vertex3d;
t: number;
} | undefined;
export declare const LineEvaluation: {
getPointOnLine: typeof getPointOnLine;
getIntersection: typeof getIntersection;
getParameterOnLine: typeof getParameterOnLine;
getFootPointOnLine: typeof getFootPointOnLine;
getFootPointOnDirection: typeof getFootPointOnDirection;
};
export {};
//# sourceMappingURL=lineEvaluationUtils.d.ts.map