ConstraintVertex.js 770 B

1234567891011121314151617181920212223242526272829303132
  1. import Vertex from './quadedge/Vertex'
  2. export default class ConstraintVertex extends Vertex {
  3. constructor() {
  4. super()
  5. ConstraintVertex.constructor_.apply(this, arguments)
  6. }
  7. static constructor_() {
  8. this._isOnConstraint = null
  9. this._constraint = null
  10. const p = arguments[0]
  11. Vertex.constructor_.call(this, p)
  12. }
  13. getConstraint() {
  14. return this._constraint
  15. }
  16. setOnConstraint(isOnConstraint) {
  17. this._isOnConstraint = isOnConstraint
  18. }
  19. merge(other) {
  20. if (other._isOnConstraint) {
  21. this._isOnConstraint = true
  22. this._constraint = other._constraint
  23. }
  24. }
  25. isOnConstraint() {
  26. return this._isOnConstraint
  27. }
  28. setConstraint(constraint) {
  29. this._isOnConstraint = true
  30. this._constraint = constraint
  31. }
  32. }