| 27 | * @standard |
| 28 | */ |
| 29 | export class Triangle implements ShapePrimitive |
| 30 | { |
| 31 | /** |
| 32 | * The type of the object, mainly used to avoid `instanceof` checks |
| 33 | * @example |
| 34 | * ```ts |
| 35 | * // Check shape type |
| 36 | * const shape = new Triangle(0, 0, 100, 0, 50, 100); |
| 37 | * console.log(shape.type); // 'triangle' |
| 38 | * |
| 39 | * // Use in type guards |
| 40 | * if (shape.type === 'triangle') { |
| 41 | * console.log(shape.x2, shape.y2); |
| 42 | * } |
| 43 | * ``` |
| 44 | * @readonly |
| 45 | * @default 'triangle' |
| 46 | * @see {@link SHAPE_PRIMITIVE} For all shape types |
| 47 | */ |
| 48 | public readonly type: SHAPE_PRIMITIVE = 'triangle'; |
| 49 | |
| 50 | /** |
| 51 | * The X coordinate of the first point of the triangle. |
| 52 | * @example |
| 53 | * ```ts |
| 54 | * // Set first point x position |
| 55 | * const triangle = new Triangle(); |
| 56 | * triangle.x = 100; |
| 57 | * ``` |
| 58 | * @default 0 |
| 59 | */ |
| 60 | public x: number; |
| 61 | |
| 62 | /** |
| 63 | * The Y coordinate of the first point of the triangle. |
| 64 | * @example |
| 65 | * ```ts |
| 66 | * // Set first point y position |
| 67 | * const triangle = new Triangle(); |
| 68 | * triangle.y = 100; |
| 69 | * ``` |
| 70 | * @default 0 |
| 71 | */ |
| 72 | public y: number; |
| 73 | |
| 74 | /** |
| 75 | * The X coordinate of the second point of the triangle. |
| 76 | * @example |
| 77 | * ```ts |
| 78 | * // Create horizontal line for second point |
| 79 | * const triangle = new Triangle(0, 0); |
| 80 | * triangle.x2 = triangle.x + 100; // 100 units to the right |
| 81 | * ``` |
| 82 | * @default 0 |
| 83 | */ |
| 84 | public x2: number; |
| 85 | |
| 86 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected