12345678910111213141516171819202122232425 |
- import { PointModel } from "../../point-component/models/point-model";
- export class IntersectionModel extends PointModel {
- constructor(posX, posY, label, r, s) {
- super(posX, posY, label);
- this.r = r;
- this.s = s;
- }
- update(aggregator, event) {
- const intersection = this.r.getIntersection(this.s);
- this.posX = parseFloat(intersection.posX.toFixed(2));
- this.posY = parseFloat(intersection.posY.toFixed(2));
- if (!this.r.insideSegment(this.posX, this.posY)) {
- this.posX = Number.MAX_SAFE_INTEGER;
- this.posY = Number.MAX_SAFE_INTEGER;
- return;
- }
- if (!this.s.insideSegment(this.posX, this.posY)) {
- this.posX = Number.MAX_SAFE_INTEGER;
- this.posY = Number.MAX_SAFE_INTEGER;
- return;
- }
- }
- }
|