import VectorType from '../enum/VectorType.js' import SelectState from '../enum/SelectState.js' import Geometry from './Geometry' import { mathUtil } from '../MathUtil.js' import Constant from '../Constant.js' import { coordinate } from '../Coordinate' //不靠墙 export default class Flue extends Geometry { constructor(center, vectorId) { super() this.center = center this.angle = 0 //逆时针为正,顺时针为负。单位是:° this.points2d = [] this.sideWidth = 0.65 this.sideThickness = 0.65 this.name = '烟道' this.geoType = VectorType.Flue this.setId(vectorId) } isContain(position) { let points = [] points.push(this.points2d[0]) points.push(this.points2d[1]) points.push(this.points2d[2]) points.push(this.points2d[3]) return mathUtil.isPointInPoly(position, points) } setPoints2d() { this.points2d = [] let minX = this.center.x - this.sideWidth / 2 let minY = this.center.y - this.sideThickness / 2 let maxX = this.center.x + this.sideWidth / 2 let maxY = this.center.y + this.sideThickness / 2 const point1 = this.rotatePoint( { x: minX, y: maxY, }, this.center, this.angle ) const point2 = this.rotatePoint( { x: maxX, y: maxY, }, this.center, this.angle ) const point3 = this.rotatePoint( { x: maxX, y: minY, }, this.center, this.angle ) const point4 = this.rotatePoint( { x: minX, y: minY, }, this.center, this.angle ) this.points2d.push(point1) this.points2d.push(point2) this.points2d.push(point3) this.points2d.push(point4) minX = this.center.x - (this.sideWidth - 0.1) / 2 minY = this.center.y - (this.sideThickness - 0.1) / 2 maxX = this.center.x + (this.sideWidth - 0.1) / 2 maxY = this.center.y + (this.sideThickness - 0.1) / 2 const point5 = this.rotatePoint( { x: minX, y: maxY, }, this.center, this.angle ) const point6 = this.rotatePoint( { x: maxX, y: maxY, }, this.center, this.angle ) const point7 = this.rotatePoint( { x: maxX, y: minY, }, this.center, this.angle ) const point8 = this.rotatePoint( { x: minX, y: minY, }, this.center, this.angle ) const point9 = { x: (this.center.x + point6.x) / 2, y: (this.center.y + point6.y) / 2, } this.points2d.push(point5) this.points2d.push(point6) this.points2d.push(point7) this.points2d.push(point8) this.points2d.push(point9) } }