ducjs 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/flatbuffers/duc/alternate-units.d.ts +21 -0
- package/dist/flatbuffers/duc/alternate-units.js +66 -0
- package/dist/flatbuffers/duc/angular-unit-system.d.ts +17 -0
- package/dist/flatbuffers/duc/angular-unit-system.js +50 -0
- package/dist/flatbuffers/duc/angular-units-format.d.ts +7 -0
- package/dist/flatbuffers/duc/angular-units-format.js +10 -0
- package/dist/flatbuffers/duc/axis.d.ts +5 -0
- package/dist/flatbuffers/duc/axis.js +8 -0
- package/dist/flatbuffers/duc/bezier-mirroring.d.ts +5 -0
- package/dist/flatbuffers/duc/bezier-mirroring.js +8 -0
- package/dist/flatbuffers/duc/blending.d.ts +9 -0
- package/dist/flatbuffers/duc/blending.js +12 -0
- package/dist/flatbuffers/duc/block-attachment.d.ts +4 -0
- package/dist/flatbuffers/duc/block-attachment.js +7 -0
- package/dist/flatbuffers/duc/boolean-operation.d.ts +6 -0
- package/dist/flatbuffers/duc/boolean-operation.js +9 -0
- package/dist/flatbuffers/duc/bound-element.d.ts +17 -0
- package/dist/flatbuffers/duc/bound-element.js +48 -0
- package/dist/flatbuffers/duc/checkpoint.d.ts +22 -0
- package/dist/flatbuffers/duc/checkpoint.js +75 -0
- package/dist/flatbuffers/duc/column-layout.d.ts +22 -0
- package/dist/flatbuffers/duc/column-layout.js +72 -0
- package/dist/flatbuffers/duc/column-type.d.ts +5 -0
- package/dist/flatbuffers/duc/column-type.js +8 -0
- package/dist/flatbuffers/duc/custom-hatch-pattern.d.ts +23 -0
- package/dist/flatbuffers/duc/custom-hatch-pattern.js +71 -0
- package/dist/flatbuffers/duc/datum-bracket-style.d.ts +5 -0
- package/dist/flatbuffers/duc/datum-bracket-style.js +8 -0
- package/dist/flatbuffers/duc/datum-reference.d.ts +17 -0
- package/dist/flatbuffers/duc/datum-reference.js +49 -0
- package/dist/flatbuffers/duc/datum-target-type.d.ts +6 -0
- package/dist/flatbuffers/duc/datum-target-type.js +9 -0
- package/dist/flatbuffers/duc/decimal-separator.d.ts +4 -0
- package/dist/flatbuffers/duc/decimal-separator.js +7 -0
- package/dist/flatbuffers/duc/delta.d.ts +20 -0
- package/dist/flatbuffers/duc/delta.js +64 -0
- package/dist/flatbuffers/duc/dictionary-entry.d.ts +17 -0
- package/dist/flatbuffers/duc/dictionary-entry.js +49 -0
- package/dist/flatbuffers/duc/dimension-baseline-data.d.ts +14 -0
- package/dist/flatbuffers/duc/dimension-baseline-data.js +40 -0
- package/dist/flatbuffers/duc/dimension-bindings.d.ts +17 -0
- package/dist/flatbuffers/duc/dimension-bindings.js +50 -0
- package/dist/flatbuffers/duc/dimension-continue-data.d.ts +14 -0
- package/dist/flatbuffers/duc/dimension-continue-data.js +40 -0
- package/dist/flatbuffers/duc/dimension-definition-points.d.ts +21 -0
- package/dist/flatbuffers/duc/dimension-definition-points.js +64 -0
- package/dist/flatbuffers/duc/dimension-ext-line-style.d.ts +18 -0
- package/dist/flatbuffers/duc/dimension-ext-line-style.js +57 -0
- package/dist/flatbuffers/duc/dimension-fit-rule.d.ts +6 -0
- package/dist/flatbuffers/duc/dimension-fit-rule.js +9 -0
- package/dist/flatbuffers/duc/dimension-fit-style.d.ts +19 -0
- package/dist/flatbuffers/duc/dimension-fit-style.js +58 -0
- package/dist/flatbuffers/duc/dimension-line-style.d.ts +16 -0
- package/dist/flatbuffers/duc/dimension-line-style.js +49 -0
- package/dist/flatbuffers/duc/dimension-symbol-style.d.ts +22 -0
- package/dist/flatbuffers/duc/dimension-symbol-style.js +72 -0
- package/dist/flatbuffers/duc/dimension-text-placement.d.ts +5 -0
- package/dist/flatbuffers/duc/dimension-text-placement.js +8 -0
- package/dist/flatbuffers/duc/dimension-tolerance-style.d.ts +24 -0
- package/dist/flatbuffers/duc/dimension-tolerance-style.js +71 -0
- package/dist/flatbuffers/duc/dimension-type.d.ts +15 -0
- package/dist/flatbuffers/duc/dimension-type.js +18 -0
- package/dist/flatbuffers/duc/dimension-units-format.d.ts +7 -0
- package/dist/flatbuffers/duc/dimension-units-format.js +10 -0
- package/dist/flatbuffers/duc/dimension-validation-rules.d.ts +25 -0
- package/dist/flatbuffers/duc/dimension-validation-rules.js +74 -0
- package/dist/flatbuffers/duc/duc-arrow-element.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-arrow-element.js +49 -0
- package/dist/flatbuffers/duc/duc-block-attribute-definition-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-block-attribute-definition-entry.js +44 -0
- package/dist/flatbuffers/duc/duc-block-attribute-definition.d.ts +22 -0
- package/dist/flatbuffers/duc/duc-block-attribute-definition.js +64 -0
- package/dist/flatbuffers/duc/duc-block-duplication-array.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-block-duplication-array.js +64 -0
- package/dist/flatbuffers/duc/duc-block-instance-element.d.ts +30 -0
- package/dist/flatbuffers/duc/duc-block-instance-element.js +94 -0
- package/dist/flatbuffers/duc/duc-block.d.ts +34 -0
- package/dist/flatbuffers/duc/duc-block.js +111 -0
- package/dist/flatbuffers/duc/duc-common-style.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-common-style.js +44 -0
- package/dist/flatbuffers/duc/duc-dimension-element.d.ts +45 -0
- package/dist/flatbuffers/duc/duc-dimension-element.js +120 -0
- package/dist/flatbuffers/duc/duc-dimension-style.d.ts +28 -0
- package/dist/flatbuffers/duc/duc-dimension-style.js +76 -0
- package/dist/flatbuffers/duc/duc-doc-element.d.ts +33 -0
- package/dist/flatbuffers/duc/duc-doc-element.js +95 -0
- package/dist/flatbuffers/duc/duc-doc-style.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-doc-style.js +52 -0
- package/dist/flatbuffers/duc/duc-element-base.d.ts +88 -0
- package/dist/flatbuffers/duc/duc-element-base.js +269 -0
- package/dist/flatbuffers/duc/duc-element-styles-base.d.ts +30 -0
- package/dist/flatbuffers/duc/duc-element-styles-base.js +103 -0
- package/dist/flatbuffers/duc/duc-ellipse-element.d.ts +22 -0
- package/dist/flatbuffers/duc/duc-ellipse-element.js +73 -0
- package/dist/flatbuffers/duc/duc-embeddable-element.d.ts +14 -0
- package/dist/flatbuffers/duc/duc-embeddable-element.js +41 -0
- package/dist/flatbuffers/duc/duc-external-file-data.d.ts +27 -0
- package/dist/flatbuffers/duc/duc-external-file-data.js +92 -0
- package/dist/flatbuffers/duc/duc-external-file-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-external-file-entry.js +44 -0
- package/dist/flatbuffers/duc/duc-feature-control-frame-element.d.ts +31 -0
- package/dist/flatbuffers/duc/duc-feature-control-frame-element.js +89 -0
- package/dist/flatbuffers/duc/duc-feature-control-frame-style.d.ts +25 -0
- package/dist/flatbuffers/duc/duc-feature-control-frame-style.js +68 -0
- package/dist/flatbuffers/duc/duc-frame-element.d.ts +14 -0
- package/dist/flatbuffers/duc/duc-frame-element.js +41 -0
- package/dist/flatbuffers/duc/duc-free-draw-element.d.ts +52 -0
- package/dist/flatbuffers/duc/duc-free-draw-element.js +154 -0
- package/dist/flatbuffers/duc/duc-free-draw-ends.d.ts +18 -0
- package/dist/flatbuffers/duc/duc-free-draw-ends.js +56 -0
- package/dist/flatbuffers/duc/duc-global-state.d.ts +37 -0
- package/dist/flatbuffers/duc/duc-global-state.js +121 -0
- package/dist/flatbuffers/duc/duc-group.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-group.js +44 -0
- package/dist/flatbuffers/duc/duc-hatch-style.d.ts +28 -0
- package/dist/flatbuffers/duc/duc-hatch-style.js +79 -0
- package/dist/flatbuffers/duc/duc-head.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-head.js +57 -0
- package/dist/flatbuffers/duc/duc-image-element.d.ts +35 -0
- package/dist/flatbuffers/duc/duc-image-element.js +91 -0
- package/dist/flatbuffers/duc/duc-image-filter.d.ts +15 -0
- package/dist/flatbuffers/duc/duc-image-filter.js +48 -0
- package/dist/flatbuffers/duc/duc-layer-overrides.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-layer-overrides.js +44 -0
- package/dist/flatbuffers/duc/duc-layer.d.ts +21 -0
- package/dist/flatbuffers/duc/duc-layer.js +59 -0
- package/dist/flatbuffers/duc/duc-leader-element.d.ts +22 -0
- package/dist/flatbuffers/duc/duc-leader-element.js +60 -0
- package/dist/flatbuffers/duc/duc-leader-style.d.ts +30 -0
- package/dist/flatbuffers/duc/duc-leader-style.js +87 -0
- package/dist/flatbuffers/duc/duc-line-reference.d.ts +15 -0
- package/dist/flatbuffers/duc/duc-line-reference.js +43 -0
- package/dist/flatbuffers/duc/duc-line.d.ts +15 -0
- package/dist/flatbuffers/duc/duc-line.js +43 -0
- package/dist/flatbuffers/duc/duc-linear-element-base.d.ts +38 -0
- package/dist/flatbuffers/duc/duc-linear-element-base.js +124 -0
- package/dist/flatbuffers/duc/duc-linear-element.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-linear-element.js +49 -0
- package/dist/flatbuffers/duc/duc-local-state.d.ts +68 -0
- package/dist/flatbuffers/duc/duc-local-state.js +206 -0
- package/dist/flatbuffers/duc/duc-mermaid-element.d.ts +23 -0
- package/dist/flatbuffers/duc/duc-mermaid-element.js +65 -0
- package/dist/flatbuffers/duc/duc-parametric-element.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-parametric-element.js +44 -0
- package/dist/flatbuffers/duc/duc-path.d.ts +26 -0
- package/dist/flatbuffers/duc/duc-path.js +69 -0
- package/dist/flatbuffers/duc/duc-pdf-element.d.ts +17 -0
- package/dist/flatbuffers/duc/duc-pdf-element.js +49 -0
- package/dist/flatbuffers/duc/duc-plot-element.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-plot-element.js +52 -0
- package/dist/flatbuffers/duc/duc-plot-style.d.ts +14 -0
- package/dist/flatbuffers/duc/duc-plot-style.js +41 -0
- package/dist/flatbuffers/duc/duc-point-binding.d.ts +26 -0
- package/dist/flatbuffers/duc/duc-point-binding.js +73 -0
- package/dist/flatbuffers/duc/duc-point.d.ts +18 -0
- package/dist/flatbuffers/duc/duc-point.js +57 -0
- package/dist/flatbuffers/duc/duc-polygon-element.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-polygon-element.js +49 -0
- package/dist/flatbuffers/duc/duc-rectangle-element.d.ts +14 -0
- package/dist/flatbuffers/duc/duc-rectangle-element.js +41 -0
- package/dist/flatbuffers/duc/duc-region.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-region.js +51 -0
- package/dist/flatbuffers/duc/duc-stack-base.d.ts +27 -0
- package/dist/flatbuffers/duc/duc-stack-base.js +78 -0
- package/dist/flatbuffers/duc/duc-stack-element-base.d.ts +23 -0
- package/dist/flatbuffers/duc/duc-stack-element-base.js +65 -0
- package/dist/flatbuffers/duc/duc-stack-like-styles.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-stack-like-styles.js +48 -0
- package/dist/flatbuffers/duc/duc-table-auto-size.d.ts +15 -0
- package/dist/flatbuffers/duc/duc-table-auto-size.js +48 -0
- package/dist/flatbuffers/duc/duc-table-cell-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-table-cell-entry.js +44 -0
- package/dist/flatbuffers/duc/duc-table-cell-span.d.ts +15 -0
- package/dist/flatbuffers/duc/duc-table-cell-span.js +48 -0
- package/dist/flatbuffers/duc/duc-table-cell-style.d.ts +22 -0
- package/dist/flatbuffers/duc/duc-table-cell-style.js +59 -0
- package/dist/flatbuffers/duc/duc-table-cell.d.ts +27 -0
- package/dist/flatbuffers/duc/duc-table-cell.js +72 -0
- package/dist/flatbuffers/duc/duc-table-column-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-table-column-entry.js +44 -0
- package/dist/flatbuffers/duc/duc-table-column.d.ts +18 -0
- package/dist/flatbuffers/duc/duc-table-column.js +51 -0
- package/dist/flatbuffers/duc/duc-table-element.d.ts +51 -0
- package/dist/flatbuffers/duc/duc-table-element.js +167 -0
- package/dist/flatbuffers/duc/duc-table-row-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-table-row-entry.js +44 -0
- package/dist/flatbuffers/duc/duc-table-row.d.ts +18 -0
- package/dist/flatbuffers/duc/duc-table-row.js +51 -0
- package/dist/flatbuffers/duc/duc-table-style.d.ts +23 -0
- package/dist/flatbuffers/duc/duc-table-style.js +65 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-dictionary-source.d.ts +14 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-dictionary-source.js +40 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-element-source.d.ts +17 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-element-source.js +49 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-part.d.ts +22 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-part.js +58 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-source-data.d.ts +9 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-source-data.js +26 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-source.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-source.js +58 -0
- package/dist/flatbuffers/duc/duc-text-element.d.ts +33 -0
- package/dist/flatbuffers/duc/duc-text-element.js +94 -0
- package/dist/flatbuffers/duc/duc-text-style.d.ts +44 -0
- package/dist/flatbuffers/duc/duc-text-style.js +128 -0
- package/dist/flatbuffers/duc/duc-ucs.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-ucs.js +49 -0
- package/dist/flatbuffers/duc/duc-view.d.ts +24 -0
- package/dist/flatbuffers/duc/duc-view.js +71 -0
- package/dist/flatbuffers/duc/duc-viewport-element.d.ts +36 -0
- package/dist/flatbuffers/duc/duc-viewport-element.js +102 -0
- package/dist/flatbuffers/duc/duc-viewport-style.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-viewport-style.js +49 -0
- package/dist/flatbuffers/duc/duc-xray-element.d.ts +23 -0
- package/dist/flatbuffers/duc/duc-xray-element.js +66 -0
- package/dist/flatbuffers/duc/duc-xray-style.d.ts +17 -0
- package/dist/flatbuffers/duc/duc-xray-style.js +49 -0
- package/dist/flatbuffers/duc/dynamic-snap-settings.d.ts +17 -0
- package/dist/flatbuffers/duc/dynamic-snap-settings.js +56 -0
- package/dist/flatbuffers/duc/element-background.d.ts +14 -0
- package/dist/flatbuffers/duc/element-background.js +41 -0
- package/dist/flatbuffers/duc/element-content-base.d.ts +29 -0
- package/dist/flatbuffers/duc/element-content-base.js +80 -0
- package/dist/flatbuffers/duc/element-content-preference.d.ts +8 -0
- package/dist/flatbuffers/duc/element-content-preference.js +11 -0
- package/dist/flatbuffers/duc/element-stroke.d.ts +24 -0
- package/dist/flatbuffers/duc/element-stroke.js +66 -0
- package/dist/flatbuffers/duc/element-wrapper.d.ts +16 -0
- package/dist/flatbuffers/duc/element-wrapper.js +49 -0
- package/dist/flatbuffers/duc/element.d.ts +49 -0
- package/dist/flatbuffers/duc/element.js +106 -0
- package/dist/flatbuffers/duc/exported-data-state.d.ts +87 -0
- package/dist/flatbuffers/duc/exported-data-state.js +290 -0
- package/dist/flatbuffers/duc/fcfbetween-modifier.d.ts +17 -0
- package/dist/flatbuffers/duc/fcfbetween-modifier.js +48 -0
- package/dist/flatbuffers/duc/fcfdatum-definition.d.ts +16 -0
- package/dist/flatbuffers/duc/fcfdatum-definition.js +43 -0
- package/dist/flatbuffers/duc/fcfdatum-style.d.ts +14 -0
- package/dist/flatbuffers/duc/fcfdatum-style.js +41 -0
- package/dist/flatbuffers/duc/fcfframe-modifiers.d.ts +22 -0
- package/dist/flatbuffers/duc/fcfframe-modifiers.js +65 -0
- package/dist/flatbuffers/duc/fcflayout-style.d.ts +17 -0
- package/dist/flatbuffers/duc/fcflayout-style.js +56 -0
- package/dist/flatbuffers/duc/fcfprojected-zone-modifier.d.ts +13 -0
- package/dist/flatbuffers/duc/fcfprojected-zone-modifier.js +40 -0
- package/dist/flatbuffers/duc/fcfsegment-row.d.ts +17 -0
- package/dist/flatbuffers/duc/fcfsegment-row.js +55 -0
- package/dist/flatbuffers/duc/fcfsymbol-style.d.ts +13 -0
- package/dist/flatbuffers/duc/fcfsymbol-style.js +40 -0
- package/dist/flatbuffers/duc/feature-control-frame-segment.d.ts +22 -0
- package/dist/flatbuffers/duc/feature-control-frame-segment.js +65 -0
- package/dist/flatbuffers/duc/feature-modifier.d.ts +18 -0
- package/dist/flatbuffers/duc/feature-modifier.js +21 -0
- package/dist/flatbuffers/duc/gdt-symbol.d.ts +22 -0
- package/dist/flatbuffers/duc/gdt-symbol.js +25 -0
- package/dist/flatbuffers/duc/geometric-point.d.ts +10 -0
- package/dist/flatbuffers/duc/geometric-point.js +27 -0
- package/dist/flatbuffers/duc/grid-display-type.d.ts +6 -0
- package/dist/flatbuffers/duc/grid-display-type.js +9 -0
- package/dist/flatbuffers/duc/grid-settings.d.ts +54 -0
- package/dist/flatbuffers/duc/grid-settings.js +165 -0
- package/dist/flatbuffers/duc/grid-style.d.ts +26 -0
- package/dist/flatbuffers/duc/grid-style.js +74 -0
- package/dist/flatbuffers/duc/grid-type.d.ts +7 -0
- package/dist/flatbuffers/duc/grid-type.js +10 -0
- package/dist/flatbuffers/duc/handle-type.d.ts +4 -0
- package/dist/flatbuffers/duc/handle-type.js +7 -0
- package/dist/flatbuffers/duc/hatch-pattern-line.d.ts +35 -0
- package/dist/flatbuffers/duc/hatch-pattern-line.js +93 -0
- package/dist/flatbuffers/duc/hatch-style.d.ts +5 -0
- package/dist/flatbuffers/duc/hatch-style.js +8 -0
- package/dist/flatbuffers/duc/identified-common-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-common-style.js +44 -0
- package/dist/flatbuffers/duc/identified-dimension-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-dimension-style.js +44 -0
- package/dist/flatbuffers/duc/identified-doc-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-doc-style.js +44 -0
- package/dist/flatbuffers/duc/identified-fcfstyle.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-fcfstyle.js +44 -0
- package/dist/flatbuffers/duc/identified-grid-settings.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-grid-settings.js +44 -0
- package/dist/flatbuffers/duc/identified-hatch-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-hatch-style.js +44 -0
- package/dist/flatbuffers/duc/identified-leader-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-leader-style.js +44 -0
- package/dist/flatbuffers/duc/identified-snap-settings.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-snap-settings.js +44 -0
- package/dist/flatbuffers/duc/identified-stack-like-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-stack-like-style.js +44 -0
- package/dist/flatbuffers/duc/identified-table-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-table-style.js +44 -0
- package/dist/flatbuffers/duc/identified-text-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-text-style.js +44 -0
- package/dist/flatbuffers/duc/identified-ucs.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-ucs.js +44 -0
- package/dist/flatbuffers/duc/identified-view.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-view.js +44 -0
- package/dist/flatbuffers/duc/identified-viewport-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-viewport-style.js +44 -0
- package/dist/flatbuffers/duc/identified-xray-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-xray-style.js +44 -0
- package/dist/flatbuffers/duc/identifier.d.ts +20 -0
- package/dist/flatbuffers/duc/identifier.js +57 -0
- package/dist/flatbuffers/duc/image-crop.d.ts +23 -0
- package/dist/flatbuffers/duc/image-crop.js +80 -0
- package/dist/flatbuffers/duc/image-status.d.ts +5 -0
- package/dist/flatbuffers/duc/image-status.js +8 -0
- package/dist/flatbuffers/duc/isometric-grid-settings.d.ts +15 -0
- package/dist/flatbuffers/duc/isometric-grid-settings.js +48 -0
- package/dist/flatbuffers/duc/jsonpatch-operation.d.ts +23 -0
- package/dist/flatbuffers/duc/jsonpatch-operation.js +64 -0
- package/dist/flatbuffers/duc/layer-snap-filters.d.ts +23 -0
- package/dist/flatbuffers/duc/layer-snap-filters.js +76 -0
- package/dist/flatbuffers/duc/layer-validation-rules.d.ts +17 -0
- package/dist/flatbuffers/duc/layer-validation-rules.js +54 -0
- package/dist/flatbuffers/duc/leader-block-content.d.ts +25 -0
- package/dist/flatbuffers/duc/leader-block-content.js +85 -0
- package/dist/flatbuffers/duc/leader-content-data.d.ts +9 -0
- package/dist/flatbuffers/duc/leader-content-data.js +26 -0
- package/dist/flatbuffers/duc/leader-content-type.d.ts +4 -0
- package/dist/flatbuffers/duc/leader-content-type.js +7 -0
- package/dist/flatbuffers/duc/leader-content.d.ts +19 -0
- package/dist/flatbuffers/duc/leader-content.js +58 -0
- package/dist/flatbuffers/duc/leader-text-block-content.d.ts +14 -0
- package/dist/flatbuffers/duc/leader-text-block-content.js +40 -0
- package/dist/flatbuffers/duc/line-head.d.ts +17 -0
- package/dist/flatbuffers/duc/line-head.js +20 -0
- package/dist/flatbuffers/duc/line-spacing-type.d.ts +5 -0
- package/dist/flatbuffers/duc/line-spacing-type.js +8 -0
- package/dist/flatbuffers/duc/line-spacing.d.ts +16 -0
- package/dist/flatbuffers/duc/line-spacing.js +49 -0
- package/dist/flatbuffers/duc/linear-unit-system.d.ts +24 -0
- package/dist/flatbuffers/duc/linear-unit-system.js +75 -0
- package/dist/flatbuffers/duc/margins.d.ts +19 -0
- package/dist/flatbuffers/duc/margins.js +64 -0
- package/dist/flatbuffers/duc/mark-ellipse-center.d.ts +4 -0
- package/dist/flatbuffers/duc/mark-ellipse-center.js +7 -0
- package/dist/flatbuffers/duc/material-condition.d.ts +5 -0
- package/dist/flatbuffers/duc/material-condition.js +8 -0
- package/dist/flatbuffers/duc/object-snap-mode.d.ts +22 -0
- package/dist/flatbuffers/duc/object-snap-mode.js +25 -0
- package/dist/flatbuffers/duc/paragraph-formatting.d.ts +33 -0
- package/dist/flatbuffers/duc/paragraph-formatting.js +106 -0
- package/dist/flatbuffers/duc/parametric-source-type.d.ts +4 -0
- package/dist/flatbuffers/duc/parametric-source-type.js +7 -0
- package/dist/flatbuffers/duc/parametric-source.d.ts +20 -0
- package/dist/flatbuffers/duc/parametric-source.js +57 -0
- package/dist/flatbuffers/duc/plot-layout.d.ts +14 -0
- package/dist/flatbuffers/duc/plot-layout.js +41 -0
- package/dist/flatbuffers/duc/point-binding-point.d.ts +15 -0
- package/dist/flatbuffers/duc/point-binding-point.js +48 -0
- package/dist/flatbuffers/duc/polar-grid-settings.d.ts +17 -0
- package/dist/flatbuffers/duc/polar-grid-settings.js +56 -0
- package/dist/flatbuffers/duc/polar-tracking-settings.d.ts +29 -0
- package/dist/flatbuffers/duc/polar-tracking-settings.js +90 -0
- package/dist/flatbuffers/duc/primary-units.d.ts +16 -0
- package/dist/flatbuffers/duc/primary-units.js +44 -0
- package/dist/flatbuffers/duc/pruning-level.d.ts +5 -0
- package/dist/flatbuffers/duc/pruning-level.js +8 -0
- package/dist/flatbuffers/duc/snap-marker-settings.d.ts +23 -0
- package/dist/flatbuffers/duc/snap-marker-settings.js +79 -0
- package/dist/flatbuffers/duc/snap-marker-shape.d.ts +6 -0
- package/dist/flatbuffers/duc/snap-marker-shape.js +9 -0
- package/dist/flatbuffers/duc/snap-marker-style-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/snap-marker-style-entry.js +43 -0
- package/dist/flatbuffers/duc/snap-marker-style.d.ts +17 -0
- package/dist/flatbuffers/duc/snap-marker-style.js +49 -0
- package/dist/flatbuffers/duc/snap-mode.d.ts +4 -0
- package/dist/flatbuffers/duc/snap-mode.js +7 -0
- package/dist/flatbuffers/duc/snap-override-behavior.d.ts +5 -0
- package/dist/flatbuffers/duc/snap-override-behavior.js +8 -0
- package/dist/flatbuffers/duc/snap-override.d.ts +17 -0
- package/dist/flatbuffers/duc/snap-override.js +49 -0
- package/dist/flatbuffers/duc/snap-settings.d.ts +75 -0
- package/dist/flatbuffers/duc/snap-settings.js +245 -0
- package/dist/flatbuffers/duc/stack-format-properties.d.ts +18 -0
- package/dist/flatbuffers/duc/stack-format-properties.js +57 -0
- package/dist/flatbuffers/duc/stack-format.d.ts +21 -0
- package/dist/flatbuffers/duc/stack-format.js +64 -0
- package/dist/flatbuffers/duc/stacked-text-align.d.ts +5 -0
- package/dist/flatbuffers/duc/stacked-text-align.js +8 -0
- package/dist/flatbuffers/duc/standard-overrides.d.ts +63 -0
- package/dist/flatbuffers/duc/standard-overrides.js +162 -0
- package/dist/flatbuffers/duc/standard-styles.d.ts +77 -0
- package/dist/flatbuffers/duc/standard-styles.js +285 -0
- package/dist/flatbuffers/duc/standard-units.d.ts +16 -0
- package/dist/flatbuffers/duc/standard-units.js +44 -0
- package/dist/flatbuffers/duc/standard-validation.d.ts +16 -0
- package/dist/flatbuffers/duc/standard-validation.js +44 -0
- package/dist/flatbuffers/duc/standard-view-settings.d.ts +35 -0
- package/dist/flatbuffers/duc/standard-view-settings.js +124 -0
- package/dist/flatbuffers/duc/standard.d.ts +33 -0
- package/dist/flatbuffers/duc/standard.js +90 -0
- package/dist/flatbuffers/duc/string-value-entry.d.ts +17 -0
- package/dist/flatbuffers/duc/string-value-entry.js +49 -0
- package/dist/flatbuffers/duc/stroke-cap.d.ts +5 -0
- package/dist/flatbuffers/duc/stroke-cap.js +8 -0
- package/dist/flatbuffers/duc/stroke-join.d.ts +5 -0
- package/dist/flatbuffers/duc/stroke-join.js +8 -0
- package/dist/flatbuffers/duc/stroke-placement.d.ts +5 -0
- package/dist/flatbuffers/duc/stroke-placement.js +8 -0
- package/dist/flatbuffers/duc/stroke-preference.d.ts +6 -0
- package/dist/flatbuffers/duc/stroke-preference.js +9 -0
- package/dist/flatbuffers/duc/stroke-side-preference.d.ts +8 -0
- package/dist/flatbuffers/duc/stroke-side-preference.js +11 -0
- package/dist/flatbuffers/duc/stroke-sides.d.ts +24 -0
- package/dist/flatbuffers/duc/stroke-sides.js +67 -0
- package/dist/flatbuffers/duc/stroke-style.d.ts +37 -0
- package/dist/flatbuffers/duc/stroke-style.js +111 -0
- package/dist/flatbuffers/duc/stroke-width.d.ts +5 -0
- package/dist/flatbuffers/duc/stroke-width.js +8 -0
- package/dist/flatbuffers/duc/table-cell-alignment.d.ts +11 -0
- package/dist/flatbuffers/duc/table-cell-alignment.js +14 -0
- package/dist/flatbuffers/duc/table-flow-direction.d.ts +4 -0
- package/dist/flatbuffers/duc/table-flow-direction.js +7 -0
- package/dist/flatbuffers/duc/text-align.d.ts +5 -0
- package/dist/flatbuffers/duc/text-align.js +8 -0
- package/dist/flatbuffers/duc/text-column.d.ts +15 -0
- package/dist/flatbuffers/duc/text-column.js +48 -0
- package/dist/flatbuffers/duc/text-field-source-property.d.ts +13 -0
- package/dist/flatbuffers/duc/text-field-source-property.js +16 -0
- package/dist/flatbuffers/duc/text-field-source-type.d.ts +4 -0
- package/dist/flatbuffers/duc/text-field-source-type.js +7 -0
- package/dist/flatbuffers/duc/text-flow-direction.d.ts +6 -0
- package/dist/flatbuffers/duc/text-flow-direction.js +9 -0
- package/dist/flatbuffers/duc/tiling-properties.d.ts +21 -0
- package/dist/flatbuffers/duc/tiling-properties.js +75 -0
- package/dist/flatbuffers/duc/tolerance-clause.d.ts +27 -0
- package/dist/flatbuffers/duc/tolerance-clause.js +84 -0
- package/dist/flatbuffers/duc/tolerance-display.d.ts +7 -0
- package/dist/flatbuffers/duc/tolerance-display.js +10 -0
- package/dist/flatbuffers/duc/tolerance-type.d.ts +5 -0
- package/dist/flatbuffers/duc/tolerance-type.js +8 -0
- package/dist/flatbuffers/duc/tolerance-zone-type.d.ts +7 -0
- package/dist/flatbuffers/duc/tolerance-zone-type.js +10 -0
- package/dist/flatbuffers/duc/tracking-line-style.d.ts +26 -0
- package/dist/flatbuffers/duc/tracking-line-style.js +74 -0
- package/dist/flatbuffers/duc/unit-precision.d.ts +19 -0
- package/dist/flatbuffers/duc/unit-precision.js +64 -0
- package/dist/flatbuffers/duc/unit-system-base.d.ts +20 -0
- package/dist/flatbuffers/duc/unit-system-base.js +65 -0
- package/dist/flatbuffers/duc/unit-system.d.ts +4 -0
- package/dist/flatbuffers/duc/unit-system.js +7 -0
- package/dist/flatbuffers/duc/version-base.d.ts +27 -0
- package/dist/flatbuffers/duc/version-base.js +80 -0
- package/dist/flatbuffers/duc/version-graph-metadata.d.ts +15 -0
- package/dist/flatbuffers/duc/version-graph-metadata.js +48 -0
- package/dist/flatbuffers/duc/version-graph.d.ts +31 -0
- package/dist/flatbuffers/duc/version-graph.js +94 -0
- package/dist/flatbuffers/duc/vertical-align.d.ts +5 -0
- package/dist/flatbuffers/duc/vertical-align.js +8 -0
- package/dist/flatbuffers/duc/viewport-shade-plot.d.ts +6 -0
- package/dist/flatbuffers/duc/viewport-shade-plot.js +9 -0
- package/dist/flatbuffers/duc/youtube-states.d.ts +8 -0
- package/dist/flatbuffers/duc/youtube-states.js +11 -0
- package/dist/flatbuffers/duc.d.ts +227 -0
- package/dist/flatbuffers/duc.js +229 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/legacy/index.d.ts +1 -0
- package/dist/legacy/index.js +1 -0
- package/dist/legacy/v1/duc/app-state.d.ts +124 -0
- package/dist/legacy/v1/duc/app-state.js +388 -0
- package/dist/legacy/v1/duc/binary-file-data.d.ts +27 -0
- package/dist/legacy/v1/duc/binary-file-data.js +90 -0
- package/dist/legacy/v1/duc/binary-files-entry.d.ts +16 -0
- package/dist/legacy/v1/duc/binary-files-entry.js +43 -0
- package/dist/legacy/v1/duc/binary-files.d.ts +17 -0
- package/dist/legacy/v1/duc/binary-files.js +55 -0
- package/dist/legacy/v1/duc/binding-point.d.ts +15 -0
- package/dist/legacy/v1/duc/binding-point.js +48 -0
- package/dist/legacy/v1/duc/bound-element.d.ts +17 -0
- package/dist/legacy/v1/duc/bound-element.js +48 -0
- package/dist/legacy/v1/duc/duc-block-attribute-details.d.ts +22 -0
- package/dist/legacy/v1/duc/duc-block-attribute-details.js +57 -0
- package/dist/legacy/v1/duc/duc-block-attribute.d.ts +16 -0
- package/dist/legacy/v1/duc/duc-block-attribute.js +43 -0
- package/dist/legacy/v1/duc/duc-block-instance-element-override.d.ts +17 -0
- package/dist/legacy/v1/duc/duc-block-instance-element-override.js +48 -0
- package/dist/legacy/v1/duc/duc-block.d.ts +34 -0
- package/dist/legacy/v1/duc/duc-block.js +110 -0
- package/dist/legacy/v1/duc/duc-element.d.ts +273 -0
- package/dist/legacy/v1/duc/duc-element.js +865 -0
- package/dist/legacy/v1/duc/duc-group.d.ts +40 -0
- package/dist/legacy/v1/duc/duc-group.js +114 -0
- package/dist/legacy/v1/duc/duc-line-reference.d.ts +15 -0
- package/dist/legacy/v1/duc/duc-line-reference.js +43 -0
- package/dist/legacy/v1/duc/duc-line.d.ts +15 -0
- package/dist/legacy/v1/duc/duc-line.js +43 -0
- package/dist/legacy/v1/duc/duc-path.d.ts +26 -0
- package/dist/legacy/v1/duc/duc-path.js +69 -0
- package/dist/legacy/v1/duc/duc-table-cell.d.ts +22 -0
- package/dist/legacy/v1/duc/duc-table-cell.js +57 -0
- package/dist/legacy/v1/duc/duc-table-column.d.ts +18 -0
- package/dist/legacy/v1/duc/duc-table-column.js +50 -0
- package/dist/legacy/v1/duc/duc-table-row.d.ts +18 -0
- package/dist/legacy/v1/duc/duc-table-row.js +50 -0
- package/dist/legacy/v1/duc/duc-table-style-props.d.ts +39 -0
- package/dist/legacy/v1/duc/duc-table-style-props.js +114 -0
- package/dist/legacy/v1/duc/duc-table-style.d.ts +14 -0
- package/dist/legacy/v1/duc/duc-table-style.js +41 -0
- package/dist/legacy/v1/duc/element-background.d.ts +14 -0
- package/dist/legacy/v1/duc/element-background.js +41 -0
- package/dist/legacy/v1/duc/element-content-base.d.ts +22 -0
- package/dist/legacy/v1/duc/element-content-base.js +64 -0
- package/dist/legacy/v1/duc/element-stroke.d.ts +23 -0
- package/dist/legacy/v1/duc/element-stroke.js +66 -0
- package/dist/legacy/v1/duc/exported-data-state.d.ts +51 -0
- package/dist/legacy/v1/duc/exported-data-state.js +155 -0
- package/dist/legacy/v1/duc/image-crop.d.ts +23 -0
- package/dist/legacy/v1/duc/image-crop.js +80 -0
- package/dist/legacy/v1/duc/linear-element-editor.d.ts +44 -0
- package/dist/legacy/v1/duc/linear-element-editor.js +119 -0
- package/dist/legacy/v1/duc/point-binding.d.ts +25 -0
- package/dist/legacy/v1/duc/point-binding.js +72 -0
- package/dist/legacy/v1/duc/point.d.ts +20 -0
- package/dist/legacy/v1/duc/point.js +63 -0
- package/dist/legacy/v1/duc/pointer-down-state.d.ts +32 -0
- package/dist/legacy/v1/duc/pointer-down-state.js +90 -0
- package/dist/legacy/v1/duc/renderer-state.d.ts +17 -0
- package/dist/legacy/v1/duc/renderer-state.js +54 -0
- package/dist/legacy/v1/duc/segment-midpoint-state.d.ts +18 -0
- package/dist/legacy/v1/duc/segment-midpoint-state.js +57 -0
- package/dist/legacy/v1/duc/simple-point.d.ts +15 -0
- package/dist/legacy/v1/duc/simple-point.js +48 -0
- package/dist/legacy/v1/duc/stroke-sides.d.ts +23 -0
- package/dist/legacy/v1/duc/stroke-sides.js +66 -0
- package/dist/legacy/v1/duc/stroke-style.d.ts +31 -0
- package/dist/legacy/v1/duc/stroke-style.js +102 -0
- package/dist/legacy/v1/duc/tiling-properties.d.ts +21 -0
- package/dist/legacy/v1/duc/tiling-properties.js +75 -0
- package/dist/legacy/v1/duc.d.ts +35 -0
- package/dist/legacy/v1/duc.js +37 -0
- package/dist/legacy/v1/index.d.ts +1 -0
- package/dist/legacy/v1/index.js +1 -0
- package/dist/legacy/v1/parse/index.d.ts +67 -0
- package/dist/legacy/v1/parse/index.js +101 -0
- package/dist/legacy/v1/parse/parseAppStateFromBinary.d.ts +3 -0
- package/dist/legacy/v1/parse/parseAppStateFromBinary.js +139 -0
- package/dist/legacy/v1/parse/parseBinaryFilesFromBinary.d.ts +4 -0
- package/dist/legacy/v1/parse/parseBinaryFilesFromBinary.js +32 -0
- package/dist/legacy/v1/parse/parseBlockFromBinary.d.ts +3 -0
- package/dist/legacy/v1/parse/parseBlockFromBinary.js +70 -0
- package/dist/legacy/v1/parse/parseElementFromBinary.d.ts +8 -0
- package/dist/legacy/v1/parse/parseElementFromBinary.js +387 -0
- package/dist/legacy/v1/parse/parseGroupFromBinary.d.ts +4 -0
- package/dist/legacy/v1/parse/parseGroupFromBinary.js +36 -0
- package/dist/legacy/v1/parse/parseRendererStateFromBinary.d.ts +4 -0
- package/dist/legacy/v1/parse/parseRendererStateFromBinary.js +15 -0
- package/dist/legacy/v1/serialize/index.d.ts +5 -0
- package/dist/legacy/v1/serialize/index.js +81 -0
- package/dist/legacy/v1/serialize/serializationUtils.d.ts +17 -0
- package/dist/legacy/v1/serialize/serializationUtils.js +27 -0
- package/dist/legacy/v1/serialize/serializeAppStateFromDuc.d.ts +4 -0
- package/dist/legacy/v1/serialize/serializeAppStateFromDuc.js +145 -0
- package/dist/legacy/v1/serialize/serializeBinaryFilesFromDuc.d.ts +4 -0
- package/dist/legacy/v1/serialize/serializeBinaryFilesFromDuc.js +46 -0
- package/dist/legacy/v1/serialize/serializeBlockFromDuc.d.ts +3 -0
- package/dist/legacy/v1/serialize/serializeBlockFromDuc.js +60 -0
- package/dist/legacy/v1/serialize/serializeElementFromDuc.d.ts +8 -0
- package/dist/legacy/v1/serialize/serializeElementFromDuc.js +435 -0
- package/dist/legacy/v1/serialize/serializeGroupFromDuc.d.ts +3 -0
- package/dist/legacy/v1/serialize/serializeGroupFromDuc.js +37 -0
- package/dist/legacy/v1/serialize/serializeRendererStateFromDuc.d.ts +4 -0
- package/dist/legacy/v1/serialize/serializeRendererStateFromDuc.js +7 -0
- package/dist/legacy/v1/types/elements/index.d.ts +480 -0
- package/dist/legacy/v1/types/elements/index.js +1 -0
- package/dist/legacy/v1/types/elements/typeChecks.d.ts +40 -0
- package/dist/legacy/v1/types/elements/typeChecks.js +179 -0
- package/dist/legacy/v1/types/geometryTypes.d.ts +78 -0
- package/dist/legacy/v1/types/geometryTypes.js +1 -0
- package/dist/legacy/v1/types/index.d.ts +496 -0
- package/dist/legacy/v1/types/index.js +1 -0
- package/dist/legacy/v1/types/utility-types.d.ts +31 -0
- package/dist/legacy/v1/types/utility-types.js +1 -0
- package/dist/legacy/v1/utils/bounds.d.ts +76 -0
- package/dist/legacy/v1/utils/bounds.js +415 -0
- package/dist/legacy/v1/utils/constants.d.ts +370 -0
- package/dist/legacy/v1/utils/constants.js +571 -0
- package/dist/legacy/v1/utils/elements/index.d.ts +26 -0
- package/dist/legacy/v1/utils/elements/index.js +108 -0
- package/dist/legacy/v1/utils/elements/linearElement.d.ts +133 -0
- package/dist/legacy/v1/utils/elements/linearElement.js +544 -0
- package/dist/legacy/v1/utils/elements/textElement.d.ts +89 -0
- package/dist/legacy/v1/utils/elements/textElement.js +563 -0
- package/dist/legacy/v1/utils/index.d.ts +26 -0
- package/dist/legacy/v1/utils/index.js +40 -0
- package/dist/legacy/v1/utils/math/algebra/ga.d.ts +63 -0
- package/dist/legacy/v1/utils/math/algebra/ga.js +268 -0
- package/dist/legacy/v1/utils/math/algebra/gadirections.d.ts +9 -0
- package/dist/legacy/v1/utils/math/algebra/gadirections.js +18 -0
- package/dist/legacy/v1/utils/math/algebra/galines.d.ts +23 -0
- package/dist/legacy/v1/utils/math/algebra/galines.js +32 -0
- package/dist/legacy/v1/utils/math/algebra/gapoints.d.ts +8 -0
- package/dist/legacy/v1/utils/math/algebra/gapoints.js +30 -0
- package/dist/legacy/v1/utils/math/algebra/gatransforms.d.ts +10 -0
- package/dist/legacy/v1/utils/math/algebra/gatransforms.js +23 -0
- package/dist/legacy/v1/utils/math/bbox.d.ts +10 -0
- package/dist/legacy/v1/utils/math/bbox.js +42 -0
- package/dist/legacy/v1/utils/math/geometry.d.ts +102 -0
- package/dist/legacy/v1/utils/math/geometry.js +790 -0
- package/dist/legacy/v1/utils/math/index.d.ts +309 -0
- package/dist/legacy/v1/utils/math/index.js +1140 -0
- package/dist/legacy/v1/utils/math/random.d.ts +4 -0
- package/dist/legacy/v1/utils/math/random.js +25 -0
- package/dist/legacy/v1/utils/measurements.d.ts +33 -0
- package/dist/legacy/v1/utils/measurements.js +65 -0
- package/dist/legacy/v1/utils/normalize.d.ts +14 -0
- package/dist/legacy/v1/utils/normalize.js +49 -0
- package/dist/legacy/v1/utils/restore.d.ts +197 -0
- package/dist/legacy/v1/utils/restore.js +1255 -0
- package/dist/legacy/v1/utils/scopes.d.ts +260 -0
- package/dist/legacy/v1/utils/scopes.js +661 -0
- package/dist/legacy/v1/utils/standards.d.ts +12 -0
- package/dist/legacy/v1/utils/standards.js +10 -0
- package/dist/legacy/v1/utils/state/index.d.ts +2 -0
- package/dist/legacy/v1/utils/state/index.js +68 -0
- package/dist/legacy/v1/utils/url.d.ts +8 -0
- package/dist/legacy/v1/utils/url.js +33 -0
- package/dist/parse.d.ts +54 -0
- package/dist/parse.js +1318 -0
- package/dist/restore/index.d.ts +3 -0
- package/dist/restore/index.js +3 -0
- package/dist/restore/restoreDataState.d.ts +191 -0
- package/dist/restore/restoreDataState.js +716 -0
- package/dist/restore/restoreElements.d.ts +34 -0
- package/dist/restore/restoreElements.js +1281 -0
- package/dist/restore/restoreStandards.d.ts +8 -0
- package/dist/restore/restoreStandards.js +224 -0
- package/dist/serialize.d.ts +3 -0
- package/dist/serialize.js +2465 -0
- package/dist/technical/index.d.ts +3 -0
- package/dist/technical/index.js +3 -0
- package/dist/technical/measurements.d.ts +31 -0
- package/dist/technical/measurements.js +64 -0
- package/dist/technical/scopes.d.ts +261 -0
- package/dist/technical/scopes.js +661 -0
- package/dist/technical/standards.d.ts +124 -0
- package/dist/technical/standards.js +10 -0
- package/dist/types/elements/index.d.ts +1356 -0
- package/dist/types/elements/index.js +1 -0
- package/dist/types/elements/typeChecks.d.ts +40 -0
- package/dist/types/elements/typeChecks.js +188 -0
- package/dist/types/geometryTypes.d.ts +90 -0
- package/dist/types/geometryTypes.js +1 -0
- package/dist/types/index.d.ts +591 -0
- package/dist/types/index.js +3 -0
- package/dist/types/utility-types.d.ts +31 -0
- package/dist/types/utility-types.js +1 -0
- package/dist/utils/bounds.d.ts +75 -0
- package/dist/utils/bounds.js +414 -0
- package/dist/utils/constants.d.ts +288 -0
- package/dist/utils/constants.js +529 -0
- package/dist/utils/elements/frameElement.d.ts +4 -0
- package/dist/utils/elements/frameElement.js +16 -0
- package/dist/utils/elements/freedrawElement.d.ts +2 -0
- package/dist/utils/elements/freedrawElement.js +46 -0
- package/dist/utils/elements/index.d.ts +51 -0
- package/dist/utils/elements/index.js +215 -0
- package/dist/utils/elements/linearElement.d.ts +53 -0
- package/dist/utils/elements/linearElement.js +539 -0
- package/dist/utils/elements/newElement.d.ts +72 -0
- package/dist/utils/elements/newElement.js +268 -0
- package/dist/utils/elements/textElement.d.ts +89 -0
- package/dist/utils/elements/textElement.js +565 -0
- package/dist/utils/elements/viewportElement.d.ts +6 -0
- package/dist/utils/elements/viewportElement.js +9 -0
- package/dist/utils/filebyte.d.ts +39 -0
- package/dist/utils/filebyte.js +117 -0
- package/dist/utils/functionCodec.d.ts +5 -0
- package/dist/utils/functionCodec.js +86 -0
- package/dist/utils/index.d.ts +32 -0
- package/dist/utils/index.js +53 -0
- package/dist/utils/math/algebra/ga.d.ts +63 -0
- package/dist/utils/math/algebra/ga.js +268 -0
- package/dist/utils/math/algebra/gadirections.d.ts +9 -0
- package/dist/utils/math/algebra/gadirections.js +18 -0
- package/dist/utils/math/algebra/galines.d.ts +23 -0
- package/dist/utils/math/algebra/galines.js +32 -0
- package/dist/utils/math/algebra/gapoints.d.ts +8 -0
- package/dist/utils/math/algebra/gapoints.js +30 -0
- package/dist/utils/math/algebra/gatransforms.d.ts +10 -0
- package/dist/utils/math/algebra/gatransforms.js +23 -0
- package/dist/utils/math/algebra/index.d.ts +5 -0
- package/dist/utils/math/algebra/index.js +5 -0
- package/dist/utils/math/bbox.d.ts +10 -0
- package/dist/utils/math/bbox.js +42 -0
- package/dist/utils/math/geometry.d.ts +102 -0
- package/dist/utils/math/geometry.js +790 -0
- package/dist/utils/math/index.d.ts +323 -0
- package/dist/utils/math/index.js +1188 -0
- package/dist/utils/math/random.d.ts +4 -0
- package/dist/utils/math/random.js +25 -0
- package/dist/utils/normalize.d.ts +14 -0
- package/dist/utils/normalize.js +49 -0
- package/dist/utils/shape.d.ts +15 -0
- package/dist/utils/shape.js +254 -0
- package/dist/utils/state/grid.d.ts +7 -0
- package/dist/utils/state/grid.js +25 -0
- package/dist/utils/state/index.d.ts +9 -0
- package/dist/utils/state/index.js +131 -0
- package/dist/utils/url.d.ts +8 -0
- package/dist/utils/url.js +33 -0
- package/dist/utils/version.d.ts +1 -0
- package/dist/utils/version.js +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,790 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file defines pure geometric shapes
|
|
3
|
+
*
|
|
4
|
+
* For instance, a cubic bezier curve is specified by its four control points and
|
|
5
|
+
* an ellipse is defined by its center, angle, semi-major axis, and semi-minor axis
|
|
6
|
+
* (but in halfWidth and halfHeight instead, so it's more relevant to Duc).
|
|
7
|
+
*
|
|
8
|
+
* The idea with pure shapes is so that we can provide collision and other geometric methods not depending on
|
|
9
|
+
* the specifics of roughjs or elements in Duc; instead, we can focus on the pure shapes themselves.
|
|
10
|
+
*
|
|
11
|
+
* Also included in this file are methods for converting a Duc element or a Drawable from roughjs
|
|
12
|
+
* to pure shapes.
|
|
13
|
+
*/
|
|
14
|
+
import { addVectors, distance2d, rotatePoint, scaleVector, subtractVectors, } from "ducjs/legacy/v1/utils/math";
|
|
15
|
+
import { crossProduct } from "ducjs/legacy/v1/utils/math/bbox";
|
|
16
|
+
const DEFAULT_THRESHOLD = 10e-5;
|
|
17
|
+
/**
|
|
18
|
+
* Utils
|
|
19
|
+
*/
|
|
20
|
+
// The two vectors are AO and BO
|
|
21
|
+
export const cross = (a, b, o) => {
|
|
22
|
+
return (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
|
|
23
|
+
};
|
|
24
|
+
export const dot = (a, b, o) => {
|
|
25
|
+
return (a.x - o.x) * (b.x - o.x) + (a.y - o.y) * (b.y - o.y);
|
|
26
|
+
};
|
|
27
|
+
export const isClosed = (polygon) => {
|
|
28
|
+
const first = polygon[0];
|
|
29
|
+
const last = polygon[polygon.length - 1];
|
|
30
|
+
return first.x === last.x && first.y === last.y;
|
|
31
|
+
};
|
|
32
|
+
export const close = (polygon) => {
|
|
33
|
+
return isClosed(polygon) ? polygon : [...polygon, polygon[0]];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Angles
|
|
37
|
+
*/
|
|
38
|
+
// Convert radians to degrees
|
|
39
|
+
export const angleToDegrees = (angle) => {
|
|
40
|
+
const theta = (angle * 180) / Math.PI;
|
|
41
|
+
return theta < 0 ? 360 + theta : theta;
|
|
42
|
+
};
|
|
43
|
+
// Convert degrees to radians
|
|
44
|
+
export const angleToRadians = (angle) => {
|
|
45
|
+
return (angle / 180) * Math.PI;
|
|
46
|
+
};
|
|
47
|
+
// Return the angle of reflection given an angle of incidence and a surface angle in degrees
|
|
48
|
+
export const angleReflect = (incidenceAngle, surfaceAngle) => {
|
|
49
|
+
const a = surfaceAngle * 2 - incidenceAngle;
|
|
50
|
+
return a >= 360 ? a - 360 : a < 0 ? a + 360 : a;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Points
|
|
54
|
+
*/
|
|
55
|
+
// Rotate a given point about a given origin by the given angle in radians
|
|
56
|
+
const rotate = (point, angle) => {
|
|
57
|
+
return {
|
|
58
|
+
x: point.x * Math.cos(angle) - point.y * Math.sin(angle),
|
|
59
|
+
y: point.x * Math.sin(angle) + point.y * Math.cos(angle),
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const isOrigin = (point) => {
|
|
63
|
+
return point.x === 0 && point.y === 0;
|
|
64
|
+
};
|
|
65
|
+
// Rotate a given point about a given origin by the given angle in degrees
|
|
66
|
+
// Rotate a given point about a given origin by the given angle in degrees
|
|
67
|
+
export const pointRotate = (point, angle, origin) => {
|
|
68
|
+
const r = angleToRadians(angle);
|
|
69
|
+
if (!origin || isOrigin(origin)) {
|
|
70
|
+
return rotate(point, r); // Rotate around (0, 0) if origin is undefined or at (0, 0)
|
|
71
|
+
}
|
|
72
|
+
// Translate, rotate, and translate back
|
|
73
|
+
const translatedPoint = {
|
|
74
|
+
x: point.x - origin.x,
|
|
75
|
+
y: point.y - origin.y,
|
|
76
|
+
};
|
|
77
|
+
const rotatedPoint = rotate(translatedPoint, r);
|
|
78
|
+
return {
|
|
79
|
+
x: rotatedPoint.x + origin.x,
|
|
80
|
+
y: rotatedPoint.y + origin.y,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
// Translate a point by an angle (in degrees) and distance
|
|
84
|
+
export const pointTranslate = (point, angle = 0, distance = 0) => {
|
|
85
|
+
const radians = angleToRadians(angle);
|
|
86
|
+
return {
|
|
87
|
+
x: point.x + distance * Math.cos(radians),
|
|
88
|
+
y: point.y + distance * Math.sin(radians),
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
// Inverse of a point
|
|
92
|
+
export const pointInverse = (point) => {
|
|
93
|
+
return { x: -point.x, y: -point.y };
|
|
94
|
+
};
|
|
95
|
+
// Add two points (vectors)
|
|
96
|
+
export const pointAdd = (pointA, pointB) => {
|
|
97
|
+
return { x: pointA.x + pointB.x, y: pointA.y + pointB.y };
|
|
98
|
+
};
|
|
99
|
+
// Calculate distance between two points
|
|
100
|
+
export const distanceToPoint = (p1, p2) => {
|
|
101
|
+
return distance2d(p1.x, p1.y, p2.x, p2.y);
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Lines
|
|
105
|
+
*/
|
|
106
|
+
// Return the angle of a line, in degrees
|
|
107
|
+
export const lineAngle = (line) => {
|
|
108
|
+
return angleToDegrees(Math.atan2(line[1].y - line[0].y, line[1].x - line[0].x));
|
|
109
|
+
};
|
|
110
|
+
// Get the distance between the endpoints of a line segment
|
|
111
|
+
export const lineLength = (line) => {
|
|
112
|
+
return Math.sqrt(Math.pow(line[1].x - line[0].x, 2) + Math.pow(line[1].y - line[0].y, 2));
|
|
113
|
+
};
|
|
114
|
+
// Get the midpoint of a line segment
|
|
115
|
+
export const lineMidpoint = (line) => {
|
|
116
|
+
return {
|
|
117
|
+
x: (line[0].x + line[1].x) / 2,
|
|
118
|
+
y: (line[0].y + line[1].y) / 2,
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
// return the coordinates resulting from rotating the given line about an origin by an angle in degrees
|
|
122
|
+
// note that when the origin is not given, the midpoint of the given line is used as the origin
|
|
123
|
+
export const lineRotate = (line, angle, origin) => {
|
|
124
|
+
return line.map((point) => pointRotate(point, angle, origin || lineMidpoint(line)));
|
|
125
|
+
};
|
|
126
|
+
// returns the coordinates resulting from translating a line by an angle in degrees and a distance.
|
|
127
|
+
export const lineTranslate = (line, angle, distance) => {
|
|
128
|
+
return line.map((point) => pointTranslate(point, angle, distance));
|
|
129
|
+
};
|
|
130
|
+
export const lineInterpolate = (line, clamp = false) => {
|
|
131
|
+
const [{ x: x1, y: y1 }, { x: x2, y: y2 }] = line;
|
|
132
|
+
return (t) => {
|
|
133
|
+
const t0 = clamp ? (t < 0 ? 0 : t > 1 ? 1 : t) : t;
|
|
134
|
+
return { x: (x2 - x1) * t0 + x1, y: (y2 - y1) * t0 + y1 };
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Curves
|
|
139
|
+
*/
|
|
140
|
+
// Clone a point
|
|
141
|
+
function clone(p) {
|
|
142
|
+
return { x: p.x, y: p.y };
|
|
143
|
+
}
|
|
144
|
+
export const curveToBezier = (pointsIn, curveTightness = 0) => {
|
|
145
|
+
const len = pointsIn.length;
|
|
146
|
+
if (len < 3) {
|
|
147
|
+
throw new Error("A curve must have at least three points.");
|
|
148
|
+
}
|
|
149
|
+
const out = [];
|
|
150
|
+
if (len === 3) {
|
|
151
|
+
out.push(clone(pointsIn[0]), clone(pointsIn[1]), clone(pointsIn[2]), clone(pointsIn[2]));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const points = [];
|
|
155
|
+
points.push(pointsIn[0], pointsIn[0]);
|
|
156
|
+
for (let i = 1; i < pointsIn.length; i++) {
|
|
157
|
+
points.push(pointsIn[i]);
|
|
158
|
+
if (i === pointsIn.length - 1) {
|
|
159
|
+
points.push(pointsIn[i]);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const b = [];
|
|
163
|
+
const s = 1 - curveTightness;
|
|
164
|
+
out.push(clone(points[0]));
|
|
165
|
+
for (let i = 1; i + 2 < points.length; i++) {
|
|
166
|
+
const cachedVertArray = points[i];
|
|
167
|
+
b[0] = { x: cachedVertArray.x, y: cachedVertArray.y };
|
|
168
|
+
b[1] = {
|
|
169
|
+
x: cachedVertArray.x + (s * points[i + 1].x - s * points[i - 1].x) / 6,
|
|
170
|
+
y: cachedVertArray.y + (s * points[i + 1].y - s * points[i - 1].y) / 6,
|
|
171
|
+
};
|
|
172
|
+
b[2] = {
|
|
173
|
+
x: points[i + 1].x + (s * points[i].x - s * points[i + 2].x) / 6,
|
|
174
|
+
y: points[i + 1].y + (s * points[i].y - s * points[i + 2].y) / 6,
|
|
175
|
+
};
|
|
176
|
+
b[3] = { x: points[i + 1].x, y: points[i + 1].y };
|
|
177
|
+
out.push(b[1], b[2], b[3]);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return out;
|
|
181
|
+
};
|
|
182
|
+
export const curveRotate = (curve, angle, origin) => {
|
|
183
|
+
return curve.map((p) => pointRotate(p, angle, origin));
|
|
184
|
+
};
|
|
185
|
+
// Calculate a point on a cubic Bezier curve at parameter t
|
|
186
|
+
export const cubicBezierPoint = (t, controlPoints) => {
|
|
187
|
+
const [p0, p1, p2, p3] = controlPoints;
|
|
188
|
+
const x = Math.pow(1 - t, 3) * p0.x +
|
|
189
|
+
3 * Math.pow(1 - t, 2) * t * p1.x +
|
|
190
|
+
3 * (1 - t) * Math.pow(t, 2) * p2.x +
|
|
191
|
+
Math.pow(t, 3) * p3.x;
|
|
192
|
+
const y = Math.pow(1 - t, 3) * p0.y +
|
|
193
|
+
3 * Math.pow(1 - t, 2) * t * p1.y +
|
|
194
|
+
3 * (1 - t) * Math.pow(t, 2) * p2.y +
|
|
195
|
+
Math.pow(t, 3) * p3.y;
|
|
196
|
+
return { x, y };
|
|
197
|
+
};
|
|
198
|
+
const solveCubicEquation = (a, b, c, d) => {
|
|
199
|
+
// This function solves the cubic equation ax^3 + bx^2 + cx + d = 0
|
|
200
|
+
const roots = [];
|
|
201
|
+
const discriminant = 18 * a * b * c * d -
|
|
202
|
+
4 * Math.pow(b, 3) * d +
|
|
203
|
+
Math.pow(b, 2) * Math.pow(c, 2) -
|
|
204
|
+
4 * a * Math.pow(c, 3) -
|
|
205
|
+
27 * Math.pow(a, 2) * Math.pow(d, 2);
|
|
206
|
+
if (discriminant >= 0) {
|
|
207
|
+
const C = Math.cbrt((discriminant + Math.sqrt(discriminant)) / 2);
|
|
208
|
+
const D = Math.cbrt((discriminant - Math.sqrt(discriminant)) / 2);
|
|
209
|
+
const root1 = (-b - C - D) / (3 * a);
|
|
210
|
+
const root2 = (-b + (C + D) / 2) / (3 * a);
|
|
211
|
+
const root3 = (-b + (C + D) / 2) / (3 * a);
|
|
212
|
+
roots.push(root1, root2, root3);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
const realPart = -b / (3 * a);
|
|
216
|
+
const root1 = 2 * Math.sqrt(-b / (3 * a)) * Math.cos(Math.acos(realPart) / 3);
|
|
217
|
+
const root2 = 2 *
|
|
218
|
+
Math.sqrt(-b / (3 * a)) *
|
|
219
|
+
Math.cos((Math.acos(realPart) + 2 * Math.PI) / 3);
|
|
220
|
+
const root3 = 2 *
|
|
221
|
+
Math.sqrt(-b / (3 * a)) *
|
|
222
|
+
Math.cos((Math.acos(realPart) + 4 * Math.PI) / 3);
|
|
223
|
+
roots.push(root1, root2, root3);
|
|
224
|
+
}
|
|
225
|
+
return roots;
|
|
226
|
+
};
|
|
227
|
+
const findClosestParameter = (point, controlPoints) => {
|
|
228
|
+
// This function finds the parameter t that minimizes the distance between the point
|
|
229
|
+
// and any point on the cubic Bezier curve.
|
|
230
|
+
const [p0, p1, p2, p3] = controlPoints;
|
|
231
|
+
// Use the direct formula to find the parameter t
|
|
232
|
+
const a = p3.x - 3 * p2.x + 3 * p1.x - p0.x;
|
|
233
|
+
const b = 3 * p2.x - 6 * p1.x + 3 * p0.x;
|
|
234
|
+
const c = 3 * p1.x - 3 * p0.x;
|
|
235
|
+
const d = p0.x - point.x;
|
|
236
|
+
const rootsX = solveCubicEquation(a, b, c, d);
|
|
237
|
+
// Do the same for the y-coordinate
|
|
238
|
+
const e = p3.y - 3 * p2.y + 3 * p1.y - p0.y;
|
|
239
|
+
const f = 3 * p2.y - 6 * p1.y + 3 * p0.y;
|
|
240
|
+
const g = 3 * p1.y - 3 * p0.y;
|
|
241
|
+
const h = p0.y - point.y;
|
|
242
|
+
const rootsY = solveCubicEquation(e, f, g, h);
|
|
243
|
+
// Select the real root that is between 0 and 1 (inclusive)
|
|
244
|
+
const validRootsX = rootsX.filter((root) => root >= 0 && root <= 1);
|
|
245
|
+
const validRootsY = rootsY.filter((root) => root >= 0 && root <= 1);
|
|
246
|
+
if (validRootsX.length === 0 || validRootsY.length === 0) {
|
|
247
|
+
// No valid roots found, use the midpoint as a fallback
|
|
248
|
+
return 0.5;
|
|
249
|
+
}
|
|
250
|
+
// Choose the parameter t that minimizes the distance
|
|
251
|
+
let minDistance = Infinity;
|
|
252
|
+
let closestT = 0;
|
|
253
|
+
for (const rootX of validRootsX) {
|
|
254
|
+
for (const rootY of validRootsY) {
|
|
255
|
+
const distance = Math.sqrt(Math.pow((rootX - point.x), 2) + Math.pow((rootY - point.y), 2));
|
|
256
|
+
if (distance < minDistance) {
|
|
257
|
+
minDistance = distance;
|
|
258
|
+
closestT = (rootX + rootY) / 2; // Use the average for a smoother result
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return closestT;
|
|
263
|
+
};
|
|
264
|
+
export const cubicBezierDistance = (point, controlPoints) => {
|
|
265
|
+
// Calculate the closest point on the Bezier curve to the given point
|
|
266
|
+
const t = findClosestParameter(point, controlPoints);
|
|
267
|
+
// Calculate the coordinates of the closest point on the curve
|
|
268
|
+
const { x: closestX, y: closestY } = cubicBezierPoint(t, controlPoints);
|
|
269
|
+
// Calculate the distance between the given point and the closest point on the curve
|
|
270
|
+
const distance = Math.sqrt(Math.pow((point.x - closestX), 2) + Math.pow((point.y - closestY), 2));
|
|
271
|
+
return distance;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Polygons
|
|
275
|
+
*/
|
|
276
|
+
// Rotate a polygon by an angle in degrees around an origin
|
|
277
|
+
export const polygonRotate = (polygon, angle, origin) => {
|
|
278
|
+
return polygon.map((p) => pointRotate(p, angle, origin));
|
|
279
|
+
};
|
|
280
|
+
// Get the bounding box of a polygon
|
|
281
|
+
export const polygonBounds = (polygon) => {
|
|
282
|
+
let xMin = Infinity;
|
|
283
|
+
let xMax = -Infinity;
|
|
284
|
+
let yMin = Infinity;
|
|
285
|
+
let yMax = -Infinity;
|
|
286
|
+
for (let i = 0, l = polygon.length; i < l; i++) {
|
|
287
|
+
const p = polygon[i];
|
|
288
|
+
const x = p.x;
|
|
289
|
+
const y = p.y;
|
|
290
|
+
if (x != null && isFinite(x) && y != null && isFinite(y)) {
|
|
291
|
+
if (x < xMin) {
|
|
292
|
+
xMin = x;
|
|
293
|
+
}
|
|
294
|
+
if (x > xMax) {
|
|
295
|
+
xMax = x;
|
|
296
|
+
}
|
|
297
|
+
if (y < yMin) {
|
|
298
|
+
yMin = y;
|
|
299
|
+
}
|
|
300
|
+
if (y > yMax) {
|
|
301
|
+
yMax = y;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return [
|
|
306
|
+
{ x: xMin, y: yMin },
|
|
307
|
+
{ x: xMax, y: yMax },
|
|
308
|
+
];
|
|
309
|
+
};
|
|
310
|
+
export const polygonCentroid = (vertices) => {
|
|
311
|
+
let a = 0;
|
|
312
|
+
let x = 0;
|
|
313
|
+
let y = 0;
|
|
314
|
+
const l = vertices.length;
|
|
315
|
+
for (let i = 0; i < l; i++) {
|
|
316
|
+
const s = i === l - 1 ? 0 : i + 1;
|
|
317
|
+
const v0 = vertices[i];
|
|
318
|
+
const v1 = vertices[s];
|
|
319
|
+
const f = v0.x * v1.y - v1.x * v0.y;
|
|
320
|
+
a += f;
|
|
321
|
+
x += (v0.x + v1.x) * f;
|
|
322
|
+
y += (v0.y + v1.y) * f;
|
|
323
|
+
}
|
|
324
|
+
const d = a * 3;
|
|
325
|
+
return { x: x / d, y: y / d };
|
|
326
|
+
};
|
|
327
|
+
// Scale a polygon uniformly
|
|
328
|
+
export const polygonScale = (polygon, scale, origin) => {
|
|
329
|
+
if (!origin) {
|
|
330
|
+
origin = polygonCentroid(polygon);
|
|
331
|
+
}
|
|
332
|
+
const p = [];
|
|
333
|
+
for (let i = 0, l = polygon.length; i < l; i++) {
|
|
334
|
+
const v = polygon[i];
|
|
335
|
+
const d = lineLength([origin, v]);
|
|
336
|
+
const a = lineAngle([origin, v]);
|
|
337
|
+
p[i] = pointTranslate(origin, a, d * scale);
|
|
338
|
+
}
|
|
339
|
+
return p;
|
|
340
|
+
};
|
|
341
|
+
// Scale a polygon along the X-axis
|
|
342
|
+
export const polygonScaleX = (polygon, scale, origin) => {
|
|
343
|
+
if (!origin) {
|
|
344
|
+
origin = polygonCentroid(polygon);
|
|
345
|
+
}
|
|
346
|
+
const p = [];
|
|
347
|
+
for (let i = 0, l = polygon.length; i < l; i++) {
|
|
348
|
+
const v = polygon[i];
|
|
349
|
+
const d = lineLength([origin, v]);
|
|
350
|
+
const a = lineAngle([origin, v]);
|
|
351
|
+
const t = pointTranslate(origin, a, d * scale);
|
|
352
|
+
p[i] = { x: t.x, y: v.y };
|
|
353
|
+
}
|
|
354
|
+
return p;
|
|
355
|
+
};
|
|
356
|
+
// Scale a polygon along the Y-axis
|
|
357
|
+
export const polygonScaleY = (polygon, scale, origin) => {
|
|
358
|
+
if (!origin) {
|
|
359
|
+
origin = polygonCentroid(polygon);
|
|
360
|
+
}
|
|
361
|
+
const p = [];
|
|
362
|
+
for (let i = 0, l = polygon.length; i < l; i++) {
|
|
363
|
+
const v = polygon[i];
|
|
364
|
+
const d = lineLength([origin, v]);
|
|
365
|
+
const a = lineAngle([origin, v]);
|
|
366
|
+
const t = pointTranslate(origin, a, d * scale);
|
|
367
|
+
p[i] = { x: v.x, y: t.y };
|
|
368
|
+
}
|
|
369
|
+
return p;
|
|
370
|
+
};
|
|
371
|
+
export const polygonReflectX = (polygon, reflectFactor = 1) => {
|
|
372
|
+
const [{ x: minX }, { x: maxX }] = polygonBounds(polygon);
|
|
373
|
+
const p = [];
|
|
374
|
+
for (let i = 0, l = polygon.length; i < l; i++) {
|
|
375
|
+
const { x, y } = polygon[i];
|
|
376
|
+
const r = { x: minX + maxX - x, y };
|
|
377
|
+
if (reflectFactor === 0) {
|
|
378
|
+
p[i] = { x, y };
|
|
379
|
+
}
|
|
380
|
+
else if (reflectFactor === 1) {
|
|
381
|
+
p[i] = r;
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
const t = lineInterpolate([{ x, y }, r]);
|
|
385
|
+
p[i] = t(Math.max(Math.min(reflectFactor, 1), 0));
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return p;
|
|
389
|
+
};
|
|
390
|
+
export const polygonReflectY = (polygon, reflectFactor = 1) => {
|
|
391
|
+
const [{ y: minY }, { y: maxY }] = polygonBounds(polygon);
|
|
392
|
+
const p = [];
|
|
393
|
+
for (let i = 0, l = polygon.length; i < l; i++) {
|
|
394
|
+
const { x, y } = polygon[i];
|
|
395
|
+
const r = { x, y: minY + maxY - y };
|
|
396
|
+
if (reflectFactor === 0) {
|
|
397
|
+
p[i] = { x, y };
|
|
398
|
+
}
|
|
399
|
+
else if (reflectFactor === 1) {
|
|
400
|
+
p[i] = r;
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
const t = lineInterpolate([{ x, y }, r]);
|
|
404
|
+
p[i] = t(Math.max(Math.min(reflectFactor, 1), 0));
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return p;
|
|
408
|
+
};
|
|
409
|
+
export const polygonTranslate = (polygon, angle, distance) => {
|
|
410
|
+
return polygon.map((p) => pointTranslate(p, angle, distance));
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* Ellipses
|
|
414
|
+
*/
|
|
415
|
+
export const ellipseAxes = (ellipse) => {
|
|
416
|
+
const widthGreaterThanHeight = ellipse.halfWidth > ellipse.halfHeight;
|
|
417
|
+
const majorAxis = widthGreaterThanHeight
|
|
418
|
+
? ellipse.halfWidth * 2
|
|
419
|
+
: ellipse.halfHeight * 2;
|
|
420
|
+
const minorAxis = widthGreaterThanHeight
|
|
421
|
+
? ellipse.halfHeight * 2
|
|
422
|
+
: ellipse.halfWidth * 2;
|
|
423
|
+
return {
|
|
424
|
+
majorAxis,
|
|
425
|
+
minorAxis,
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
export const ellipseFocusToCenter = (ellipse) => {
|
|
429
|
+
const { majorAxis, minorAxis } = ellipseAxes(ellipse);
|
|
430
|
+
return Math.sqrt(Math.pow(majorAxis, 2) - Math.pow(minorAxis, 2));
|
|
431
|
+
};
|
|
432
|
+
export const ellipseExtremes = (ellipse) => {
|
|
433
|
+
const { center, angle } = ellipse;
|
|
434
|
+
const { majorAxis, minorAxis } = ellipseAxes(ellipse);
|
|
435
|
+
const cos = Math.cos(angle);
|
|
436
|
+
const sin = Math.sin(angle);
|
|
437
|
+
const sqSum = Math.pow(majorAxis, 2) + Math.pow(minorAxis, 2);
|
|
438
|
+
const sqDiff = (Math.pow(majorAxis, 2) - Math.pow(minorAxis, 2)) * Math.cos(2 * angle);
|
|
439
|
+
const yMax = Math.sqrt((sqSum - sqDiff) / 2);
|
|
440
|
+
const xAtYMax = (yMax * sqSum * sin * cos) /
|
|
441
|
+
(Math.pow(majorAxis, 2) * Math.pow(sin, 2) + Math.pow(minorAxis, 2) * Math.pow(cos, 2));
|
|
442
|
+
const xMax = Math.sqrt((sqSum + sqDiff) / 2);
|
|
443
|
+
const yAtXMax = (xMax * sqSum * sin * cos) /
|
|
444
|
+
(Math.pow(majorAxis, 2) * Math.pow(cos, 2) + Math.pow(minorAxis, 2) * Math.pow(sin, 2));
|
|
445
|
+
return [
|
|
446
|
+
pointAdd({ x: xAtYMax, y: yMax }, center),
|
|
447
|
+
pointAdd(pointInverse({ x: xAtYMax, y: yMax }), center),
|
|
448
|
+
pointAdd({ x: xMax, y: yAtXMax }, center),
|
|
449
|
+
pointAdd({ x: xMax, y: yAtXMax }, center),
|
|
450
|
+
];
|
|
451
|
+
};
|
|
452
|
+
export const pointRelativeToCenter = (point, center, angle) => {
|
|
453
|
+
const translated = pointAdd(point, pointInverse(center));
|
|
454
|
+
const rotated = pointRotate(translated, -angleToDegrees(angle));
|
|
455
|
+
return rotated;
|
|
456
|
+
};
|
|
457
|
+
/**
|
|
458
|
+
* Relationships
|
|
459
|
+
*/
|
|
460
|
+
// Ensure the top point of the line is first based on Y-coordinate
|
|
461
|
+
const topPointFirst = (line) => {
|
|
462
|
+
return line[1].y > line[0].y ? line : [line[1], line[0]];
|
|
463
|
+
};
|
|
464
|
+
// Determine if a point is to the left of a line
|
|
465
|
+
export const pointLeftofLine = (point, line) => {
|
|
466
|
+
const t = topPointFirst(line);
|
|
467
|
+
return cross(point, t[1], t[0]) < 0;
|
|
468
|
+
};
|
|
469
|
+
// Determine if a point is to the right of a line
|
|
470
|
+
export const pointRightofLine = (point, line) => {
|
|
471
|
+
const t = topPointFirst(line);
|
|
472
|
+
return cross(point, t[1], t[0]) > 0;
|
|
473
|
+
};
|
|
474
|
+
// Calculate the distance from a point to a line segment
|
|
475
|
+
export const distanceToSegment = (point, line) => {
|
|
476
|
+
const { x, y } = point;
|
|
477
|
+
const [start, end] = line;
|
|
478
|
+
const A = x - start.x;
|
|
479
|
+
const B = y - start.y;
|
|
480
|
+
const C = end.x - start.x;
|
|
481
|
+
const D = end.y - start.y;
|
|
482
|
+
const dotProd = A * C + B * D;
|
|
483
|
+
const len_sq = C * C + D * D;
|
|
484
|
+
let param = -1;
|
|
485
|
+
if (len_sq !== 0) {
|
|
486
|
+
param = dotProd / len_sq;
|
|
487
|
+
}
|
|
488
|
+
let xx, yy;
|
|
489
|
+
if (param < 0) {
|
|
490
|
+
xx = start.x;
|
|
491
|
+
yy = start.y;
|
|
492
|
+
}
|
|
493
|
+
else if (param > 1) {
|
|
494
|
+
xx = end.x;
|
|
495
|
+
yy = end.y;
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
xx = start.x + param * C;
|
|
499
|
+
yy = start.y + param * D;
|
|
500
|
+
}
|
|
501
|
+
const dx = x - xx;
|
|
502
|
+
const dy = y - yy;
|
|
503
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
504
|
+
};
|
|
505
|
+
// Determine if a point lies on a line segment within a threshold
|
|
506
|
+
export const pointOnLine = (point, line, threshold = DEFAULT_THRESHOLD) => {
|
|
507
|
+
const distance = distanceToSegment(point, line);
|
|
508
|
+
if (distance === 0) {
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
511
|
+
return distance < threshold;
|
|
512
|
+
};
|
|
513
|
+
// Determine if a point lies on any segment of a polyline within a threshold
|
|
514
|
+
export const pointOnPolyline = (point, polyline, threshold = DEFAULT_THRESHOLD) => {
|
|
515
|
+
return polyline.some((line) => pointOnLine(point, line, threshold));
|
|
516
|
+
};
|
|
517
|
+
export const lineIntersectsLine = (lineA, lineB) => {
|
|
518
|
+
const [{ x: a0x, y: a0y }, { x: a1x, y: a1y }] = lineA;
|
|
519
|
+
const [{ x: b0x, y: b0y }, { x: b1x, y: b1y }] = lineB;
|
|
520
|
+
// shared points
|
|
521
|
+
if ((a0x === b0x && a0y === b0y) || (a1x === b1x && a1y === b1y)) {
|
|
522
|
+
return true;
|
|
523
|
+
}
|
|
524
|
+
// point on line
|
|
525
|
+
if (pointOnLine(lineA[0], lineB) || pointOnLine(lineA[1], lineB)) {
|
|
526
|
+
return true;
|
|
527
|
+
}
|
|
528
|
+
if (pointOnLine(lineB[0], lineA) || pointOnLine(lineB[1], lineA)) {
|
|
529
|
+
return true;
|
|
530
|
+
}
|
|
531
|
+
const denom = (b1y - b0y) * (a1x - a0x) - (b1x - b0x) * (a1y - a0y);
|
|
532
|
+
if (denom === 0) {
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
const deltaY = a0y - b0y;
|
|
536
|
+
const deltaX = a0x - b0x;
|
|
537
|
+
const numer0 = (b1x - b0x) * deltaY - (b1y - b0y) * deltaX;
|
|
538
|
+
const numer1 = (a1x - a0x) * deltaY - (a1y - a0y) * deltaX;
|
|
539
|
+
const quotA = numer0 / denom;
|
|
540
|
+
const quotB = numer1 / denom;
|
|
541
|
+
return quotA > 0 && quotA < 1 && quotB > 0 && quotB < 1;
|
|
542
|
+
};
|
|
543
|
+
export const lineIntersectsPolygon = (line, polygon) => {
|
|
544
|
+
let intersects = false;
|
|
545
|
+
const closed = close(polygon);
|
|
546
|
+
for (let i = 0, l = closed.length - 1; i < l; i++) {
|
|
547
|
+
const v0 = closed[i];
|
|
548
|
+
const v1 = closed[i + 1];
|
|
549
|
+
if (lineIntersectsLine(line, [v0, v1]) ||
|
|
550
|
+
(pointOnLine(v0, line) && pointOnLine(v1, line))) {
|
|
551
|
+
intersects = true;
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return intersects;
|
|
556
|
+
};
|
|
557
|
+
// Check if a point lies on a Bezier curve within a threshold
|
|
558
|
+
export const pointInBezierEquation = (p0, p1, p2, p3, { x: mx, y: my }, lineThreshold) => {
|
|
559
|
+
// B(t) = p0 * (1-t)^3 + 3p1 * t * (1-t)^2 + 3p2 * t^2 * (1-t) + p3 * t^3
|
|
560
|
+
const equation = (t, coord) => Math.pow(1 - t, 3) * p3[coord] +
|
|
561
|
+
3 * t * Math.pow(1 - t, 2) * p2[coord] +
|
|
562
|
+
3 * Math.pow(t, 2) * (1 - t) * p1[coord] +
|
|
563
|
+
p0[coord] * Math.pow(t, 3);
|
|
564
|
+
const lineSegmentPoints = [];
|
|
565
|
+
let t = 0;
|
|
566
|
+
while (t <= 1.0) {
|
|
567
|
+
const tx = equation(t, 'x');
|
|
568
|
+
const ty = equation(t, 'y');
|
|
569
|
+
const diff = Math.sqrt(Math.pow(tx - mx, 2) + Math.pow(ty - my, 2));
|
|
570
|
+
if (diff < lineThreshold) {
|
|
571
|
+
return true;
|
|
572
|
+
}
|
|
573
|
+
lineSegmentPoints.push({ x: tx, y: ty });
|
|
574
|
+
t += 0.1;
|
|
575
|
+
}
|
|
576
|
+
// check the distance from line segments to the given point
|
|
577
|
+
return false;
|
|
578
|
+
};
|
|
579
|
+
export const cubicBezierEquation = (curve) => {
|
|
580
|
+
const [p0, p1, p2, p3] = curve;
|
|
581
|
+
// B(t) = p0 * (1-t)^3 + 3p1 * t * (1-t)^2 + 3p2 * t^2 * (1-t) + p3 * t^3
|
|
582
|
+
return (t, coord) => Math.pow(1 - t, 3) * p3[coord] +
|
|
583
|
+
3 * t * Math.pow(1 - t, 2) * p2[coord] +
|
|
584
|
+
3 * Math.pow(t, 2) * (1 - t) * p1[coord] +
|
|
585
|
+
p0[coord] * Math.pow(t, 3);
|
|
586
|
+
};
|
|
587
|
+
// Convert a curve to a polyline with a specified number of segments
|
|
588
|
+
export const polyLineFromCurve = (curve, segments = 10) => {
|
|
589
|
+
const equation = cubicBezierEquation(curve);
|
|
590
|
+
let startingPoint = { x: equation(0, "x"), y: equation(0, "y") };
|
|
591
|
+
const lineSegments = [];
|
|
592
|
+
let t = 0;
|
|
593
|
+
const increment = 1 / segments;
|
|
594
|
+
for (let i = 0; i < segments; i++) {
|
|
595
|
+
t += increment;
|
|
596
|
+
if (t <= 1) {
|
|
597
|
+
const nextPoint = { x: equation(t, "x"), y: equation(t, "y") };
|
|
598
|
+
lineSegments.push([startingPoint, nextPoint]);
|
|
599
|
+
startingPoint = nextPoint;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return lineSegments;
|
|
603
|
+
};
|
|
604
|
+
// Determine if a point lies on a cubic Bezier curve within a threshold
|
|
605
|
+
export const pointOnCurve = (point, curve, threshold = DEFAULT_THRESHOLD) => {
|
|
606
|
+
return pointOnPolyline(point, polyLineFromCurve(curve), threshold);
|
|
607
|
+
};
|
|
608
|
+
// Determine if a point lies on any curve in a polycurve within a threshold
|
|
609
|
+
export const pointOnPolycurve = (point, polycurve, threshold = DEFAULT_THRESHOLD) => {
|
|
610
|
+
return polycurve.some((curve) => pointOnCurve(point, curve, threshold));
|
|
611
|
+
};
|
|
612
|
+
// Determine if a point lies inside a polygon using the ray-casting algorithm
|
|
613
|
+
export const pointInPolygon = (point, polygon) => {
|
|
614
|
+
const { x, y } = point;
|
|
615
|
+
let inside = false;
|
|
616
|
+
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
617
|
+
const xi = polygon[i].x;
|
|
618
|
+
const yi = polygon[i].y;
|
|
619
|
+
const xj = polygon[j].x;
|
|
620
|
+
const yj = polygon[j].y;
|
|
621
|
+
if (((yi > y && yj <= y) || (yi <= y && yj > y)) &&
|
|
622
|
+
x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) {
|
|
623
|
+
inside = !inside;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return inside;
|
|
627
|
+
};
|
|
628
|
+
export const pointOnPolygon = (point, polygon, threshold = DEFAULT_THRESHOLD) => {
|
|
629
|
+
let on = false;
|
|
630
|
+
const closed = close(polygon);
|
|
631
|
+
for (let i = 0, l = closed.length - 1; i < l; i++) {
|
|
632
|
+
if (pointOnLine(point, [closed[i], closed[i + 1]], threshold)) {
|
|
633
|
+
on = true;
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return on;
|
|
638
|
+
};
|
|
639
|
+
// Determine if one polygon is entirely within another polygon
|
|
640
|
+
export const polygonInPolygon = (polygonA, polygonB) => {
|
|
641
|
+
let inside = true;
|
|
642
|
+
const closed = close(polygonA);
|
|
643
|
+
for (let i = 0, l = closed.length - 1; i < l; i++) {
|
|
644
|
+
const v0 = closed[i];
|
|
645
|
+
// Points test
|
|
646
|
+
if (!pointInPolygon(v0, polygonB)) {
|
|
647
|
+
inside = false;
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
// Lines test
|
|
651
|
+
if (lineIntersectsPolygon([v0, closed[i + 1]], polygonB)) {
|
|
652
|
+
inside = false;
|
|
653
|
+
break;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
return inside;
|
|
657
|
+
};
|
|
658
|
+
// Determine if two polygons intersect
|
|
659
|
+
export const polygonIntersectPolygon = (polygonA, polygonB) => {
|
|
660
|
+
let intersects = false;
|
|
661
|
+
let onCount = 0;
|
|
662
|
+
const closed = close(polygonA);
|
|
663
|
+
for (let i = 0, l = closed.length - 1; i < l; i++) {
|
|
664
|
+
const v0 = closed[i];
|
|
665
|
+
const v1 = closed[i + 1];
|
|
666
|
+
if (lineIntersectsPolygon([v0, v1], polygonB)) {
|
|
667
|
+
intersects = true;
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
670
|
+
if (pointOnPolygon(v0, polygonB)) {
|
|
671
|
+
++onCount;
|
|
672
|
+
}
|
|
673
|
+
if (onCount === 2) {
|
|
674
|
+
intersects = true;
|
|
675
|
+
break;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return intersects;
|
|
679
|
+
};
|
|
680
|
+
const distanceToEllipse = (point, ellipse) => {
|
|
681
|
+
const { angle, halfWidth: a, halfHeight: b, center } = ellipse;
|
|
682
|
+
const rotatedPoint = pointRelativeToCenter(point, center, angle);
|
|
683
|
+
const px = Math.abs(rotatedPoint.x);
|
|
684
|
+
const py = Math.abs(rotatedPoint.y);
|
|
685
|
+
let tx = 0.707;
|
|
686
|
+
let ty = 0.707;
|
|
687
|
+
for (let i = 0; i < 3; i++) {
|
|
688
|
+
const x = a * tx;
|
|
689
|
+
const y = b * ty;
|
|
690
|
+
const ex = ((a * a - b * b) * Math.pow(tx, 3)) / a;
|
|
691
|
+
const ey = ((b * b - a * a) * Math.pow(ty, 3)) / b;
|
|
692
|
+
const rx = x - ex;
|
|
693
|
+
const ry = y - ey;
|
|
694
|
+
const qx = px - ex;
|
|
695
|
+
const qy = py - ey;
|
|
696
|
+
const r = Math.hypot(ry, rx);
|
|
697
|
+
const q = Math.hypot(qy, qx);
|
|
698
|
+
tx = Math.min(1, Math.max(0, ((qx * r) / q + ex) / a));
|
|
699
|
+
ty = Math.min(1, Math.max(0, ((qy * r) / q + ey) / b));
|
|
700
|
+
const t = Math.hypot(ty, tx);
|
|
701
|
+
tx /= t;
|
|
702
|
+
ty /= t;
|
|
703
|
+
}
|
|
704
|
+
const minPoint = {
|
|
705
|
+
x: a * tx * Math.sign(rotatedPoint.x),
|
|
706
|
+
y: b * ty * Math.sign(rotatedPoint.y),
|
|
707
|
+
};
|
|
708
|
+
return distanceToPoint(rotatedPoint, minPoint);
|
|
709
|
+
};
|
|
710
|
+
// Determine if a point lies on the boundary of an ellipse within a threshold
|
|
711
|
+
export const pointOnEllipse = (point, ellipse, threshold = DEFAULT_THRESHOLD) => {
|
|
712
|
+
return distanceToEllipse(point, ellipse) <= threshold;
|
|
713
|
+
};
|
|
714
|
+
// Determine if a point lies inside an ellipse
|
|
715
|
+
export const pointInEllipse = (point, ellipse) => {
|
|
716
|
+
const { center, angle, halfWidth, halfHeight } = ellipse;
|
|
717
|
+
const { x: rotatedX, y: rotatedY } = pointRelativeToCenter(point, center, angle);
|
|
718
|
+
return (Math.pow((rotatedX / halfWidth), 2) +
|
|
719
|
+
Math.pow((rotatedY / halfHeight), 2) <=
|
|
720
|
+
1);
|
|
721
|
+
};
|
|
722
|
+
/**
|
|
723
|
+
* Segment Intersections
|
|
724
|
+
*/
|
|
725
|
+
// Calculate the intersection point of two line segments, if any
|
|
726
|
+
export const segmentsIntersectAt = (a, b) => {
|
|
727
|
+
const r = subtractVectors(a[1], a[0]);
|
|
728
|
+
const s = subtractVectors(b[1], b[0]);
|
|
729
|
+
const denominator = crossProduct(r, s);
|
|
730
|
+
if (denominator === 0) {
|
|
731
|
+
return null;
|
|
732
|
+
}
|
|
733
|
+
const i = subtractVectors(b[0], a[0]);
|
|
734
|
+
const u = crossProduct(i, r) / denominator;
|
|
735
|
+
const t = crossProduct(i, s) / denominator;
|
|
736
|
+
if (u === 0) {
|
|
737
|
+
return null;
|
|
738
|
+
}
|
|
739
|
+
const p = addVectors(a[0], scaleVector(r, t));
|
|
740
|
+
if (t >= 0 && t < 1 && u >= 0 && u < 1) {
|
|
741
|
+
return p;
|
|
742
|
+
}
|
|
743
|
+
return null;
|
|
744
|
+
};
|
|
745
|
+
/**
|
|
746
|
+
* Determine intersection of a rectangular shaped element and a
|
|
747
|
+
* line segment.
|
|
748
|
+
*
|
|
749
|
+
* @param element The rectangular element to test against
|
|
750
|
+
* @param segment The segment intersecting the element
|
|
751
|
+
* @param gap Optional value to inflate the shape before testing
|
|
752
|
+
* @returns An array of intersections
|
|
753
|
+
*/
|
|
754
|
+
// TODO: Replace with final rounded rectangle code
|
|
755
|
+
export const segmentIntersectRectangleElement = (element, segment, gap = 0) => {
|
|
756
|
+
const bounds = [
|
|
757
|
+
element.x.scoped - gap,
|
|
758
|
+
element.y.scoped - gap,
|
|
759
|
+
element.x.scoped + element.width.scoped + gap,
|
|
760
|
+
element.y.scoped + element.height.scoped + gap,
|
|
761
|
+
];
|
|
762
|
+
const center = {
|
|
763
|
+
x: (bounds[0] + bounds[2]) / 2,
|
|
764
|
+
y: (bounds[1] + bounds[3]) / 2,
|
|
765
|
+
};
|
|
766
|
+
return [
|
|
767
|
+
[
|
|
768
|
+
rotatePoint({ x: bounds[0], y: bounds[1] }, center, element.angle),
|
|
769
|
+
rotatePoint({ x: bounds[2], y: bounds[1] }, center, element.angle),
|
|
770
|
+
],
|
|
771
|
+
[
|
|
772
|
+
rotatePoint({ x: bounds[2], y: bounds[1] }, center, element.angle),
|
|
773
|
+
rotatePoint({ x: bounds[2], y: bounds[3] }, center, element.angle),
|
|
774
|
+
],
|
|
775
|
+
[
|
|
776
|
+
rotatePoint({ x: bounds[2], y: bounds[3] }, center, element.angle),
|
|
777
|
+
rotatePoint({ x: bounds[0], y: bounds[3] }, center, element.angle),
|
|
778
|
+
],
|
|
779
|
+
[
|
|
780
|
+
rotatePoint({ x: bounds[0], y: bounds[3] }, center, element.angle),
|
|
781
|
+
rotatePoint({ x: bounds[0], y: bounds[1] }, center, element.angle),
|
|
782
|
+
],
|
|
783
|
+
]
|
|
784
|
+
.map((s) => segmentsIntersectAt(segment, s))
|
|
785
|
+
.filter((i) => !!i);
|
|
786
|
+
};
|
|
787
|
+
// Utility to create a GeometricPoint
|
|
788
|
+
export function pointFrom(x, y) {
|
|
789
|
+
return { x, y };
|
|
790
|
+
}
|