jsts-rails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/jsts-rails/version.rb +1 -1
- data/vendor/assets/javascripts/javascript.util.js +33 -1
- data/vendor/assets/javascripts/jsts-original.js +164 -1573
- data/vendor/assets/javascripts/jsts.js +197 -0
- data/vendor/assets/javascripts/jsts/algorithm/Angle.js +387 -0
- data/vendor/assets/javascripts/jsts/algorithm/BoundaryNodeRule.js +67 -0
- data/vendor/assets/javascripts/jsts/algorithm/CGAlgorithms.js +596 -0
- data/vendor/assets/javascripts/jsts/algorithm/CentralEndpointIntersector.js +118 -0
- data/vendor/assets/javascripts/jsts/algorithm/CentroidArea.js +225 -0
- data/vendor/assets/javascripts/jsts/algorithm/CentroidLine.js +85 -0
- data/vendor/assets/javascripts/jsts/algorithm/CentroidPoint.js +77 -0
- data/vendor/assets/javascripts/jsts/algorithm/ConvexHull.js +409 -0
- data/vendor/assets/javascripts/jsts/algorithm/HCoordinate.js +234 -0
- data/vendor/assets/javascripts/jsts/algorithm/LineIntersector.js +502 -0
- data/vendor/assets/javascripts/jsts/algorithm/MCPointInRing.js +124 -0
- data/vendor/assets/javascripts/jsts/algorithm/PointLocator.js +247 -0
- data/vendor/assets/javascripts/jsts/algorithm/RayCrossingCounter.js +215 -0
- data/vendor/assets/javascripts/jsts/algorithm/RobustDeterminant.js +353 -0
- data/vendor/assets/javascripts/jsts/algorithm/RobustLineIntersector.js +477 -0
- data/vendor/assets/javascripts/jsts/algorithm/distance/DiscreteHausdorffDistance.js +228 -0
- data/vendor/assets/javascripts/jsts/algorithm/distance/DistanceToPoint.js +68 -0
- data/vendor/assets/javascripts/jsts/algorithm/distance/PointPairDistance.js +104 -0
- data/vendor/assets/javascripts/jsts/algorithm/locate/PointOnGeometryLocator.js +7 -0
- data/vendor/assets/javascripts/jsts/algorithm/locate/SimplePointInAreaLocator.js +102 -0
- data/vendor/assets/javascripts/jsts/geom/Coordinate.js +158 -0
- data/vendor/assets/javascripts/jsts/geom/CoordinateArrays.js +148 -0
- data/vendor/assets/javascripts/jsts/geom/CoordinateFilter.js +29 -0
- data/vendor/assets/javascripts/jsts/geom/CoordinateList.js +157 -0
- data/vendor/assets/javascripts/jsts/geom/CoordinateSequenceFilter.js +63 -0
- data/vendor/assets/javascripts/jsts/geom/Dimension.js +137 -0
- data/vendor/assets/javascripts/jsts/geom/Envelope.js +833 -0
- data/vendor/assets/javascripts/jsts/geom/Geometry.js +1535 -0
- data/vendor/assets/javascripts/jsts/geom/GeometryCollection.js +230 -0
- data/vendor/assets/javascripts/jsts/geom/GeometryComponentFilter.js +36 -0
- data/vendor/assets/javascripts/jsts/geom/GeometryFactory.js +263 -0
- data/vendor/assets/javascripts/jsts/geom/GeometryFilter.js +29 -0
- data/vendor/assets/javascripts/jsts/geom/IntersectionMatrix.js +650 -0
- data/vendor/assets/javascripts/jsts/geom/LineSegment.js +275 -0
- data/vendor/assets/javascripts/jsts/geom/LineString.js +299 -0
- data/vendor/assets/javascripts/jsts/geom/LinearRing.js +69 -0
- data/vendor/assets/javascripts/jsts/geom/Location.js +83 -0
- data/vendor/assets/javascripts/jsts/geom/MultiLineString.js +47 -0
- data/vendor/assets/javascripts/jsts/geom/MultiPoint.js +64 -0
- data/vendor/assets/javascripts/jsts/geom/MultiPolygon.js +64 -0
- data/vendor/assets/javascripts/jsts/geom/Point.js +197 -0
- data/vendor/assets/javascripts/jsts/geom/Polygon.js +263 -0
- data/vendor/assets/javascripts/jsts/geom/PrecisionModel.js +187 -0
- data/vendor/assets/javascripts/jsts/geom/Triangle.js +313 -0
- data/vendor/assets/javascripts/jsts/geom/util/GeometryCombiner.js +143 -0
- data/vendor/assets/javascripts/jsts/geom/util/GeometryExtracter.js +76 -0
- data/vendor/assets/javascripts/jsts/geom/util/GeometryTransformer.js +295 -0
- data/vendor/assets/javascripts/jsts/geom/util/LinearComponentExtracter.js +207 -0
- data/vendor/assets/javascripts/jsts/geom/util/PointExtracter.js +67 -0
- data/vendor/assets/javascripts/jsts/geom/util/PolygonExtracter.js +71 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Depth.js +145 -0
- data/vendor/assets/javascripts/jsts/geomgraph/DirectedEdge.js +270 -0
- data/vendor/assets/javascripts/jsts/geomgraph/DirectedEdgeStar.js +388 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Edge.js +291 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeEnd.js +188 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeEndStar.js +322 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeIntersection.js +122 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeIntersectionList.js +146 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeList.js +111 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeNodingValidator.js +76 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeRing.js +230 -0
- data/vendor/assets/javascripts/jsts/geomgraph/GeometryGraph.js +469 -0
- data/vendor/assets/javascripts/jsts/geomgraph/GraphComponent.js +181 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Label.js +316 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Node.js +105 -0
- data/vendor/assets/javascripts/jsts/geomgraph/NodeFactory.js +22 -0
- data/vendor/assets/javascripts/jsts/geomgraph/NodeMap.js +128 -0
- data/vendor/assets/javascripts/jsts/geomgraph/PlanarGraph.js +214 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Position.js +63 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Quadrant.js +143 -0
- data/vendor/assets/javascripts/jsts/geomgraph/TopologyLocation.js +251 -0
- data/vendor/assets/javascripts/jsts/geomgraph/index/EdgeSetIntersector.js +47 -0
- data/vendor/assets/javascripts/jsts/geomgraph/index/SegmentIntersector.js +298 -0
- data/vendor/assets/javascripts/jsts/geomgraph/index/SimpleEdgeSetIntersector.js +107 -0
- data/vendor/assets/javascripts/jsts/geomgraph/index/SimpleMCSweepLineIntersector.js +29 -0
- data/vendor/assets/javascripts/jsts/index/ArrayListVisitor.js +37 -0
- data/vendor/assets/javascripts/jsts/index/DoubleBits.js +132 -0
- data/vendor/assets/javascripts/jsts/index/IntervalSize.js +55 -0
- data/vendor/assets/javascripts/jsts/index/ItemVisitor.js +23 -0
- data/vendor/assets/javascripts/jsts/index/SpatialIndex.js +67 -0
- data/vendor/assets/javascripts/jsts/index/bintree/Bintree.js +224 -0
- data/vendor/assets/javascripts/jsts/index/bintree/Interval.js +160 -0
- data/vendor/assets/javascripts/jsts/index/bintree/Key.js +110 -0
- data/vendor/assets/javascripts/jsts/index/bintree/Node.js +204 -0
- data/vendor/assets/javascripts/jsts/index/bintree/NodeBase.js +220 -0
- data/vendor/assets/javascripts/jsts/index/bintree/Root.js +113 -0
- data/vendor/assets/javascripts/jsts/index/chain/MonotoneChain.js +244 -0
- data/vendor/assets/javascripts/jsts/index/chain/MonotoneChainBuilder.js +106 -0
- data/vendor/assets/javascripts/jsts/index/chain/MonotoneChainOverlapAction.js +56 -0
- data/vendor/assets/javascripts/jsts/index/chain/MonotoneChainSelectAction.js +44 -0
- data/vendor/assets/javascripts/jsts/index/kdtree/KdNode.js +171 -0
- data/vendor/assets/javascripts/jsts/index/kdtree/KdTree.js +218 -0
- data/vendor/assets/javascripts/jsts/index/quadtree/Key.js +134 -0
- data/vendor/assets/javascripts/jsts/index/quadtree/Node.js +220 -0
- data/vendor/assets/javascripts/jsts/index/quadtree/NodeBase.js +330 -0
- data/vendor/assets/javascripts/jsts/index/quadtree/Quadtree.js +228 -0
- data/vendor/assets/javascripts/jsts/index/quadtree/Root.js +105 -0
- data/vendor/assets/javascripts/jsts/index/strtree/AbstractNode.js +107 -0
- data/vendor/assets/javascripts/jsts/index/strtree/AbstractSTRtree.js +594 -0
- data/vendor/assets/javascripts/jsts/index/strtree/Boundable.js +37 -0
- data/vendor/assets/javascripts/jsts/index/strtree/BoundablePair.js +0 -0
- data/vendor/assets/javascripts/jsts/index/strtree/Interval.js +94 -0
- data/vendor/assets/javascripts/jsts/index/strtree/ItemBoundable.js +60 -0
- data/vendor/assets/javascripts/jsts/index/strtree/SIRtree.js +122 -0
- data/vendor/assets/javascripts/jsts/index/strtree/STRtree.js +450 -0
- data/vendor/assets/javascripts/jsts/io/GeoJSONParser.js +471 -0
- data/vendor/assets/javascripts/jsts/io/GeoJSONReader.js +58 -0
- data/vendor/assets/javascripts/jsts/io/GeoJSONWriter.js +38 -0
- data/vendor/assets/javascripts/jsts/io/OpenLayersParser.js +245 -0
- data/vendor/assets/javascripts/jsts/io/WKTParser.js +421 -0
- data/vendor/assets/javascripts/jsts/io/WKTReader.js +68 -0
- data/vendor/assets/javascripts/jsts/io/WKTWriter.js +61 -0
- data/vendor/assets/javascripts/jsts/noding/BasicSegmentString.js +87 -0
- data/vendor/assets/javascripts/jsts/noding/FastNodingValidator.js +127 -0
- data/vendor/assets/javascripts/jsts/noding/InteriorIntersectionFinder.js +171 -0
- data/vendor/assets/javascripts/jsts/noding/IntersectionAdder.js +198 -0
- data/vendor/assets/javascripts/jsts/noding/IntersectionFinderAdder.js +79 -0
- data/vendor/assets/javascripts/jsts/noding/MCIndexNoder.js +147 -0
- data/vendor/assets/javascripts/jsts/noding/NodableSegmentString.js +35 -0
- data/vendor/assets/javascripts/jsts/noding/NodedSegmentString.js +235 -0
- data/vendor/assets/javascripts/jsts/noding/Noder.js +41 -0
- data/vendor/assets/javascripts/jsts/noding/NodingValidator.js +5 -0
- data/vendor/assets/javascripts/jsts/noding/Octant.js +84 -0
- data/vendor/assets/javascripts/jsts/noding/OrientedCoordinateArray.js +94 -0
- data/vendor/assets/javascripts/jsts/noding/ScaledNoder.js +105 -0
- data/vendor/assets/javascripts/jsts/noding/SegmentIntersector.js +45 -0
- data/vendor/assets/javascripts/jsts/noding/SegmentNode.js +70 -0
- data/vendor/assets/javascripts/jsts/noding/SegmentNodeList.js +262 -0
- data/vendor/assets/javascripts/jsts/noding/SegmentPointComparator.js +78 -0
- data/vendor/assets/javascripts/jsts/noding/SegmentString.js +61 -0
- data/vendor/assets/javascripts/jsts/noding/SinglePassNoder.js +51 -0
- data/vendor/assets/javascripts/jsts/noding/snapround/HotPixel.js +271 -0
- data/vendor/assets/javascripts/jsts/noding/snapround/MCIndexPointSnapper.js +96 -0
- data/vendor/assets/javascripts/jsts/noding/snapround/MCIndexSnapRounder.js +147 -0
- data/vendor/assets/javascripts/jsts/operation/BoundaryOp.js +166 -0
- data/vendor/assets/javascripts/jsts/operation/GeometryGraphOperation.js +90 -0
- data/vendor/assets/javascripts/jsts/operation/IsSimpleOp.js +293 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/BufferBuilder.js +317 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/BufferInputLineSimplifier.js +294 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/BufferOp.js +340 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/BufferParameters.js +328 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/BufferSubgraph.js +296 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/OffsetCurveBuilder.js +369 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/OffsetCurveSetBuilder.js +301 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/OffsetSegmentGenerator.js +777 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/OffsetSegmentString.js +109 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/RightmostEdgeFinder.js +164 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/SubgraphDepthLocater.js +220 -0
- data/vendor/assets/javascripts/jsts/operation/distance/ConnectedElementLocationFilter.js +67 -0
- data/vendor/assets/javascripts/jsts/operation/distance/DistanceOp.js +506 -0
- data/vendor/assets/javascripts/jsts/operation/distance/GeometryLocation.js +102 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/LineBuilder.js +194 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/MaximalEdgeRing.js +72 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/MinimalEdgeRing.js +33 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/OverlayNodeFactory.js +26 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/OverlayOp.js +584 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/PointBuilder.js +103 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/PolygonBuilder.js +282 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/snap/GeometrySnapper.js +228 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/snap/LineStringSnapper.js +228 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/snap/SnapIfNeededOverlayOp.js +85 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/snap/SnapOverlayOp.js +134 -0
- data/vendor/assets/javascripts/jsts/operation/polygonize/EdgeRing.js +259 -0
- data/vendor/assets/javascripts/jsts/operation/polygonize/PolygonizeDirectedEdge.js +94 -0
- data/vendor/assets/javascripts/jsts/operation/polygonize/PolygonizeEdge.js +31 -0
- data/vendor/assets/javascripts/jsts/operation/polygonize/PolygonizeGraph.js +507 -0
- data/vendor/assets/javascripts/jsts/operation/polygonize/Polygonizer.js +259 -0
- data/vendor/assets/javascripts/jsts/operation/relate/EdgeEndBuilder.js +140 -0
- data/vendor/assets/javascripts/jsts/operation/relate/EdgeEndBundle.js +183 -0
- data/vendor/assets/javascripts/jsts/operation/relate/EdgeEndBundleStar.js +48 -0
- data/vendor/assets/javascripts/jsts/operation/relate/RelateComputer.js +444 -0
- data/vendor/assets/javascripts/jsts/operation/relate/RelateNode.js +46 -0
- data/vendor/assets/javascripts/jsts/operation/relate/RelateNodeFactory.js +25 -0
- data/vendor/assets/javascripts/jsts/operation/relate/RelateNodeGraph.js +118 -0
- data/vendor/assets/javascripts/jsts/operation/relate/RelateOp.js +75 -0
- data/vendor/assets/javascripts/jsts/operation/union/CascadedPolygonUnion.js +319 -0
- data/vendor/assets/javascripts/jsts/operation/union/PointGeometryUnion.js +118 -0
- data/vendor/assets/javascripts/jsts/operation/union/UnaryUnionOp.js +244 -0
- data/vendor/assets/javascripts/jsts/operation/union/UnionInteracting.js +156 -0
- data/vendor/assets/javascripts/jsts/operation/valid/ConnectedInteriorTester.js +259 -0
- data/vendor/assets/javascripts/jsts/operation/valid/ConsistentAreaTester.js +127 -0
- data/vendor/assets/javascripts/jsts/operation/valid/IndexedNestedRingTester.js +89 -0
- data/vendor/assets/javascripts/jsts/operation/valid/IsValidOp.js +619 -0
- data/vendor/assets/javascripts/jsts/operation/valid/TopologyValidationError.js +199 -0
- data/vendor/assets/javascripts/jsts/planargraph/DirectedEdge.js +232 -0
- data/vendor/assets/javascripts/jsts/planargraph/DirectedEdgeStar.js +168 -0
- data/vendor/assets/javascripts/jsts/planargraph/Edge.js +124 -0
- data/vendor/assets/javascripts/jsts/planargraph/GraphComponent.js +182 -0
- data/vendor/assets/javascripts/jsts/planargraph/Node.js +127 -0
- data/vendor/assets/javascripts/jsts/planargraph/NodeMap.js +76 -0
- data/vendor/assets/javascripts/jsts/planargraph/PlanarGraph.js +246 -0
- data/vendor/assets/javascripts/jsts/simplify/LineSegmentIndex.js +101 -0
- data/vendor/assets/javascripts/jsts/triangulate/DelaunayTriangulationBuilder.js +224 -0
- data/vendor/assets/javascripts/jsts/triangulate/IncrementalDelaunayTriangulator.js +111 -0
- data/vendor/assets/javascripts/jsts/triangulate/VoronoiDiagramBuilder.js +172 -0
- data/vendor/assets/javascripts/jsts/triangulate/quadedge/LastFoundQuadEdgeLocator.js +52 -0
- data/vendor/assets/javascripts/jsts/triangulate/quadedge/QuadEdge.js +437 -0
- data/vendor/assets/javascripts/jsts/triangulate/quadedge/QuadEdgeSubdivision.js +1064 -0
- data/vendor/assets/javascripts/jsts/triangulate/quadedge/TrianglePredicate.js +350 -0
- data/vendor/assets/javascripts/jsts/triangulate/quadedge/Vertex.js +496 -0
- data/vendor/assets/javascripts/jsts/util/Assert.js +80 -0
- data/vendor/assets/javascripts/jsts/util/AssertionFailedException.js +23 -0
- data/vendor/assets/javascripts/jsts/util/UniqueCoordinateArrayFilter.js +52 -0
- metadata +204 -1
@@ -1,2 +1,199 @@
|
|
1
1
|
//= require javascript.util
|
2
2
|
//= require jsts-original
|
3
|
+
//= require jsts/util/AssertionFailedException
|
4
|
+
//= require jsts/util/Assert
|
5
|
+
//= require jsts/geom/CoordinateArrays
|
6
|
+
//= require jsts/geom/CoordinateFilter
|
7
|
+
//= require jsts/util/UniqueCoordinateArrayFilter
|
8
|
+
//= require jsts/geom/CoordinateList
|
9
|
+
//= require jsts/geom/Dimension
|
10
|
+
//= require jsts/geom/Location
|
11
|
+
//= require jsts/geom/Geometry
|
12
|
+
//= require jsts/geom/GeometryCollection
|
13
|
+
//= require jsts/geom/GeometryFilter
|
14
|
+
//= require jsts/geom/GeometryComponentFilter
|
15
|
+
//= require jsts/geom/IntersectionMatrix
|
16
|
+
//= require jsts/geom/Coordinate
|
17
|
+
//= require jsts/geom/Envelope
|
18
|
+
//= require jsts/geom/GeometryFactory
|
19
|
+
//= require jsts/geom/LineString
|
20
|
+
//= require jsts/geom/MultiLineString
|
21
|
+
//= require jsts/geom/LinearRing
|
22
|
+
//= require jsts/geom/LineSegment
|
23
|
+
//= require jsts/geom/Point
|
24
|
+
//= require jsts/geom/MultiPoint
|
25
|
+
//= require jsts/geom/Polygon
|
26
|
+
//= require jsts/geom/MultiPolygon
|
27
|
+
//= require jsts/geom/PrecisionModel
|
28
|
+
//= require jsts/geom/Triangle
|
29
|
+
//= require jsts/geom/util/GeometryCombiner
|
30
|
+
//= require jsts/geom/util/GeometryExtracter
|
31
|
+
//= require jsts/geom/util/GeometryTransformer
|
32
|
+
//= require jsts/geom/util/LinearComponentExtracter
|
33
|
+
//= require jsts/geom/util/PointExtracter
|
34
|
+
//= require jsts/geom/util/PolygonExtracter
|
35
|
+
//= require jsts/algorithm/BoundaryNodeRule
|
36
|
+
//= require jsts/algorithm/CentralEndpointIntersector
|
37
|
+
//= require jsts/algorithm/CentroidArea
|
38
|
+
//= require jsts/algorithm/CentroidLine
|
39
|
+
//= require jsts/algorithm/CentroidPoint
|
40
|
+
//= require jsts/algorithm/CGAlgorithms
|
41
|
+
//= require jsts/algorithm/ConvexHull
|
42
|
+
//= require jsts/algorithm/HCoordinate
|
43
|
+
//= require jsts/algorithm/LineIntersector
|
44
|
+
//= require jsts/algorithm/PointLocator
|
45
|
+
//= require jsts/algorithm/RayCrossingCounter
|
46
|
+
//= require jsts/algorithm/RobustDeterminant
|
47
|
+
//= require jsts/algorithm/RobustLineIntersector
|
48
|
+
//= require jsts/algorithm/locate/SimplePointInAreaLocator
|
49
|
+
//= require jsts/planargraph/GraphComponent
|
50
|
+
//= require jsts/planargraph/Edge
|
51
|
+
//= require jsts/planargraph/DirectedEdge
|
52
|
+
//= require jsts/planargraph/DirectedEdgeStar
|
53
|
+
//= require jsts/planargraph/Node
|
54
|
+
//= require jsts/planargraph/NodeMap
|
55
|
+
//= require jsts/planargraph/PlanarGraph
|
56
|
+
//= require jsts/index/ArrayListVisitor
|
57
|
+
//= require jsts/index/DoubleBits
|
58
|
+
//= require jsts/index/IntervalSize
|
59
|
+
//= require jsts/index/ItemVisitor
|
60
|
+
//= require jsts/index/SpatialIndex
|
61
|
+
//= require jsts/index/chain/MonotoneChain
|
62
|
+
//= require jsts/index/chain/MonotoneChainBuilder
|
63
|
+
//= require jsts/index/chain/MonotoneChainOverlapAction
|
64
|
+
//= require jsts/index/chain/MonotoneChainSelectAction
|
65
|
+
|
66
|
+
// This file is included here because MCPointInRing.MCSelected requires MonotoneChainSelectAction
|
67
|
+
//= require jsts/algorithm/MCPointInRing
|
68
|
+
|
69
|
+
//= require jsts/index/kdtree/KdNode
|
70
|
+
//= require jsts/index/kdtree/KdTree
|
71
|
+
//= require jsts/index/quadtree/Key
|
72
|
+
//= require jsts/index/quadtree/NodeBase
|
73
|
+
//= require jsts/index/quadtree/Node
|
74
|
+
//= require jsts/index/quadtree/Quadtree
|
75
|
+
//= require jsts/index/quadtree/Root
|
76
|
+
//= require jsts/index/strtree/Boundable
|
77
|
+
//= require jsts/index/strtree/AbstractNode
|
78
|
+
//= require jsts/index/strtree/AbstractSTRtree
|
79
|
+
//= require jsts/index/strtree/Interval
|
80
|
+
//= require jsts/index/strtree/ItemBoundable
|
81
|
+
//= require jsts/index/strtree/SIRtree
|
82
|
+
//= require jsts/index/strtree/STRtree
|
83
|
+
//= require jsts/index/bintree/Interval
|
84
|
+
//= require jsts/index/bintree/NodeBase
|
85
|
+
//= require jsts/index/bintree/Key
|
86
|
+
//= require jsts/index/bintree/Node
|
87
|
+
//= require jsts/index/bintree/Root
|
88
|
+
//= require jsts/index/bintree/Bintree
|
89
|
+
//= require jsts/noding/SegmentIntersector
|
90
|
+
//= require jsts/noding/InteriorIntersectionFinder
|
91
|
+
//= require jsts/noding/IntersectionAdder
|
92
|
+
//= require jsts/noding/IntersectionFinderAdder
|
93
|
+
//= require jsts/noding/SegmentString
|
94
|
+
//= require jsts/noding/BasicSegmentString
|
95
|
+
//= require jsts/noding/NodableSegmentString
|
96
|
+
//= require jsts/noding/NodedSegmentString
|
97
|
+
//= require jsts/noding/Noder
|
98
|
+
//= require jsts/noding/NodingValidator
|
99
|
+
//= require jsts/noding/SinglePassNoder
|
100
|
+
//= require jsts/noding/MCIndexNoder
|
101
|
+
//= require jsts/noding/FastNodingValidator
|
102
|
+
//= require jsts/noding/Octant
|
103
|
+
//= require jsts/noding/OrientedCoordinateArray
|
104
|
+
//= require jsts/noding/ScaledNoder
|
105
|
+
//= require jsts/noding/SegmentNode
|
106
|
+
//= require jsts/noding/SegmentNodeList
|
107
|
+
//= require jsts/noding/SegmentPointComparator
|
108
|
+
//= require jsts/noding/snapround/HotPixel
|
109
|
+
//= require jsts/noding/snapround/MCIndexPointSnapper
|
110
|
+
//= require jsts/noding/snapround/MCIndexSnapRounder
|
111
|
+
//= require jsts/geomgraph/Position
|
112
|
+
//= require jsts/geomgraph/Depth
|
113
|
+
//= require jsts/geomgraph/GraphComponent
|
114
|
+
//= require jsts/geomgraph/Node
|
115
|
+
//= require jsts/geomgraph/NodeFactory
|
116
|
+
//= require jsts/geomgraph/NodeMap
|
117
|
+
//= require jsts/geomgraph/Edge
|
118
|
+
//= require jsts/geomgraph/EdgeEnd
|
119
|
+
//= require jsts/geomgraph/DirectedEdge
|
120
|
+
//= require jsts/geomgraph/EdgeEndStar
|
121
|
+
//= require jsts/geomgraph/DirectedEdgeStar
|
122
|
+
//= require jsts/geomgraph/EdgeRing
|
123
|
+
//= require jsts/geomgraph/EdgeIntersection
|
124
|
+
//= require jsts/geomgraph/EdgeIntersectionList
|
125
|
+
//= require jsts/geomgraph/EdgeList
|
126
|
+
//= require jsts/geomgraph/EdgeNodingValidator
|
127
|
+
//= require jsts/geomgraph/PlanarGraph
|
128
|
+
//= require jsts/geomgraph/GeometryGraph
|
129
|
+
//= require jsts/geomgraph/Label
|
130
|
+
//= require jsts/geomgraph/Quadrant
|
131
|
+
//= require jsts/geomgraph/TopologyLocation
|
132
|
+
//= require jsts/geomgraph/index/EdgeSetIntersector
|
133
|
+
//= require jsts/geomgraph/index/SegmentIntersector
|
134
|
+
//= require jsts/geomgraph/index/SimpleEdgeSetIntersector
|
135
|
+
//= require jsts/geomgraph/index/SimpleMCSweepLineIntersector
|
136
|
+
//= require jsts/io/OpenLayersParser
|
137
|
+
//= require jsts/io/WKTParser
|
138
|
+
//= require jsts/io/WKTReader
|
139
|
+
//= require jsts/io/WKTWriter
|
140
|
+
//= require jsts/operation/BoundaryOp
|
141
|
+
//= require jsts/operation/GeometryGraphOperation
|
142
|
+
//= require jsts/operation/IsSimpleOp
|
143
|
+
//= require jsts/operation/buffer/BufferBuilder
|
144
|
+
//= require jsts/operation/buffer/BufferInputLineSimplifier
|
145
|
+
//= require jsts/operation/buffer/BufferOp
|
146
|
+
//= require jsts/operation/buffer/BufferParameters
|
147
|
+
//= require jsts/operation/buffer/BufferSubgraph
|
148
|
+
//= require jsts/operation/buffer/OffsetCurveBuilder
|
149
|
+
//= require jsts/operation/buffer/OffsetCurveSetBuilder
|
150
|
+
//= require jsts/operation/buffer/OffsetSegmentGenerator
|
151
|
+
//= require jsts/operation/buffer/OffsetSegmentString
|
152
|
+
//= require jsts/operation/buffer/RightmostEdgeFinder
|
153
|
+
//= require jsts/operation/buffer/SubgraphDepthLocater
|
154
|
+
//= require jsts/operation/distance/ConnectedElementLocationFilter
|
155
|
+
//= require jsts/operation/distance/DistanceOp
|
156
|
+
//= require jsts/operation/distance/GeometryLocation
|
157
|
+
//= require jsts/operation/overlay/LineBuilder
|
158
|
+
//= require jsts/operation/overlay/OverlayNodeFactory
|
159
|
+
//= require jsts/operation/overlay/PolygonBuilder
|
160
|
+
//= require jsts/operation/overlay/MaximalEdgeRing
|
161
|
+
//= require jsts/operation/overlay/MinimalEdgeRing
|
162
|
+
//= require jsts/operation/overlay/LineBuilder
|
163
|
+
//= require jsts/operation/overlay/PointBuilder
|
164
|
+
//= require jsts/operation/overlay/OverlayOp
|
165
|
+
//= require jsts/operation/overlay/snap/LineStringSnapper
|
166
|
+
//= require jsts/operation/overlay/snap/GeometrySnapper
|
167
|
+
//= require jsts/operation/overlay/snap/SnapOverlayOp
|
168
|
+
//= require jsts/operation/overlay/snap/SnapIfNeededOverlayOp
|
169
|
+
//= require jsts/operation/polygonize/EdgeRing
|
170
|
+
//= require jsts/operation/polygonize/PolygonizeDirectedEdge
|
171
|
+
//= require jsts/operation/polygonize/PolygonizeEdge
|
172
|
+
//= require jsts/operation/polygonize/PolygonizeGraph
|
173
|
+
//= require jsts/operation/polygonize/Polygonizer
|
174
|
+
//= require jsts/operation/relate/EdgeEndBuilder
|
175
|
+
//= require jsts/operation/relate/EdgeEndBundle
|
176
|
+
//= require jsts/operation/relate/EdgeEndBundleStar
|
177
|
+
//= require jsts/operation/relate/RelateComputer
|
178
|
+
//= require jsts/operation/relate/RelateNode
|
179
|
+
//= require jsts/operation/relate/RelateNodeFactory
|
180
|
+
//= require jsts/operation/relate/RelateNodeGraph
|
181
|
+
//= require jsts/operation/relate/RelateOp
|
182
|
+
//= require jsts/operation/union/CascadedPolygonUnion
|
183
|
+
//= require jsts/operation/union/PointGeometryUnion
|
184
|
+
//= require jsts/operation/union/UnaryUnionOp
|
185
|
+
//= require jsts/operation/union/UnionInteracting
|
186
|
+
//= require jsts/operation/valid/IsValidOp
|
187
|
+
//= require jsts/operation/valid/TopologyValidationError
|
188
|
+
//= require jsts/operation/valid/ConsistentAreaTester
|
189
|
+
//= require jsts/operation/valid/IndexedNestedRingTester
|
190
|
+
//= require jsts/operation/valid/ConnectedInteriorTester
|
191
|
+
//= require jsts/simplify/LineSegmentIndex
|
192
|
+
//= require jsts/triangulate/DelaunayTriangulationBuilder
|
193
|
+
//= require jsts/triangulate/VoronoiDiagramBuilder
|
194
|
+
//= require jsts/triangulate/IncrementalDelaunayTriangulator
|
195
|
+
//= require jsts/triangulate/quadedge/LastFoundQuadEdgeLocator
|
196
|
+
//= require jsts/triangulate/quadedge/QuadEdge
|
197
|
+
//= require jsts/triangulate/quadedge/QuadEdgeSubdivision
|
198
|
+
//= require jsts/triangulate/quadedge/TrianglePredicate
|
199
|
+
//= require jsts/triangulate/quadedge/Vertex
|
@@ -0,0 +1,387 @@
|
|
1
|
+
/* Copyright (c) 2011 by The Authors.
|
2
|
+
* Published under the LGPL 2.1 license.
|
3
|
+
* See /license-notice.txt for the full text of the license notice.
|
4
|
+
* See /license.txt for the full text of the license.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Utility functions for working with angles.
|
11
|
+
* Unless otherwise noted, methods in this class express angles in radians.
|
12
|
+
*
|
13
|
+
* @requires jsts/algorithm/CGAlgorithms.js
|
14
|
+
*
|
15
|
+
* @constructor
|
16
|
+
*/
|
17
|
+
jsts.algorithm.Angle = function() {
|
18
|
+
|
19
|
+
};
|
20
|
+
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Pi*2
|
24
|
+
*/
|
25
|
+
jsts.algorithm.Angle.PI_TIMES_2 = 2.0 * Math.PI;
|
26
|
+
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Pi/2
|
30
|
+
*/
|
31
|
+
jsts.algorithm.Angle.PI_OVER_2 = Math.PI / 2.0;
|
32
|
+
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Pi/4
|
36
|
+
*/
|
37
|
+
jsts.algorithm.Angle.PI_OVER_4 = Math.PI / 4.0;
|
38
|
+
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Constant representing counterclockwise orientation
|
42
|
+
*/
|
43
|
+
jsts.algorithm.Angle.COUNTERCLOCKWISE = jsts.algorithm.CGAlgorithms.prototype.COUNTERCLOCKWISE;
|
44
|
+
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Constant representing clockwise orientation
|
48
|
+
*/
|
49
|
+
jsts.algorithm.Angle.CLOCKWISE = jsts.algorithm.CGAlgorithms.prototype.CLOCKWISE;
|
50
|
+
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Constant representing no orientation
|
54
|
+
*/
|
55
|
+
jsts.algorithm.Angle.NONE = jsts.algorithm.CGAlgorithms.prototype.COLLINEAR;
|
56
|
+
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Converts from radians to degrees.
|
60
|
+
*
|
61
|
+
* @param {Number}
|
62
|
+
* radians an angle in radians.
|
63
|
+
* @return {Number}
|
64
|
+
* the angle in degrees.
|
65
|
+
*/
|
66
|
+
jsts.algorithm.Angle.toDegrees = function(radians) {
|
67
|
+
return (radians * 180) / Math.PI;
|
68
|
+
};
|
69
|
+
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Converts from degrees to radians.
|
73
|
+
*
|
74
|
+
* @param {Number}
|
75
|
+
* angleDegrees an angle in degrees.
|
76
|
+
* @return {Number}
|
77
|
+
* the angle in radians.
|
78
|
+
*/
|
79
|
+
jsts.algorithm.Angle.toRadians = function(angleDegrees) {
|
80
|
+
return (angleDegrees * Math.PI) / 180.0;
|
81
|
+
};
|
82
|
+
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Returns the angle
|
86
|
+
* Calls correct angle* depending on argument
|
87
|
+
*
|
88
|
+
* @return {Number}
|
89
|
+
* The angle in radians.
|
90
|
+
*/
|
91
|
+
jsts.algorithm.Angle.angle = function() {
|
92
|
+
if (arguments.length === 1) {
|
93
|
+
return jsts.algorithm.Angle.angleFromOrigo(arguments[0]);
|
94
|
+
}else {
|
95
|
+
return jsts.algorithm.Angle.angleBetweenCoords(arguments[0], arguments[1]);
|
96
|
+
}
|
97
|
+
};
|
98
|
+
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Returns the angle of the vector from p0 to p1,
|
102
|
+
* relative to the positive X-axis.
|
103
|
+
* The angle is normalized to be in the range [ -Pi, Pi ].
|
104
|
+
*
|
105
|
+
* @param {jsts.geom.Coordinate}
|
106
|
+
* p0 a coordinate.
|
107
|
+
* @param {jsts.geom.Coordinate}
|
108
|
+
* p1 a coordinate.
|
109
|
+
* @return {Number}
|
110
|
+
* the normalized angle (in radians) that p0-p1 makes with the positive
|
111
|
+
* x-axis.
|
112
|
+
*/
|
113
|
+
jsts.algorithm.Angle.angleBetweenCoords = function(p0, p1) {
|
114
|
+
var dx, dy;
|
115
|
+
dx = p1.x - p0.x;
|
116
|
+
dy = p1.y - p0.y;
|
117
|
+
return Math.atan2(dy, dx);
|
118
|
+
};
|
119
|
+
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Returns the angle that the vector from (0,0) to p,
|
123
|
+
* relative to the positive X-axis.
|
124
|
+
* The angle is normalized to be in the range ( -Pi, Pi ].
|
125
|
+
*
|
126
|
+
* @param {jsts.geom.Coordinate}
|
127
|
+
* p a coordinate.
|
128
|
+
* @return {Number}
|
129
|
+
* the normalized angle (in radians) that p makes with the positive
|
130
|
+
* x-axis.
|
131
|
+
*/
|
132
|
+
jsts.algorithm.Angle.angleFromOrigo = function(p) {
|
133
|
+
return Math.atan2(p.y, p.x);
|
134
|
+
};
|
135
|
+
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Tests whether the angle between p0-p1-p2 is acute.
|
139
|
+
* An angle is acute if it is less than 90 degrees.
|
140
|
+
* <p>
|
141
|
+
* Note: this implementation is not precise (determistic) for angles very close to 90 degrees.
|
142
|
+
*
|
143
|
+
* @param {jsts.geom.Coordinate}
|
144
|
+
* p0 an endpoint of the angle.
|
145
|
+
* @param {jsts.geom.Coordinate}
|
146
|
+
* p1 the base of the angle.
|
147
|
+
* @param {jsts.geom.Coordinate}
|
148
|
+
* p2 the other endpoint of the angle.
|
149
|
+
* @return {Boolean}
|
150
|
+
* true if the angle is acute.
|
151
|
+
*/
|
152
|
+
jsts.algorithm.Angle.isAcute = function(p0, p1, p2) {
|
153
|
+
var dx0, dy0, dx1, dy1, dotprod;
|
154
|
+
|
155
|
+
//relies on fact that A dot B is positive if A ang B is acute
|
156
|
+
dx0 = p0.x - p1.x;
|
157
|
+
dy0 = p0.y - p1.y;
|
158
|
+
dx1 = p2.x - p1.x;
|
159
|
+
dy1 = p2.y - p1.y;
|
160
|
+
dotprod = dx0 * dx1 + dy0 * dy1;
|
161
|
+
return dotprod > 0;
|
162
|
+
};
|
163
|
+
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Tests whether the angle between p0-p1-p2 is obtuse.
|
167
|
+
* An angle is obtuse if it is greater than 90 degrees.
|
168
|
+
* <p>
|
169
|
+
* Note: this implementation is not precise (determistic) for angles very close to 90 degrees.
|
170
|
+
*
|
171
|
+
* @param {jsts.geom.Coordinate}
|
172
|
+
* p0 an endpoint of the angle.
|
173
|
+
* @param {jsts.geom.Coordinate}
|
174
|
+
* p1 the base of the angle.
|
175
|
+
* @param {jsts.geom.Coordinate}
|
176
|
+
* p2 the other endpoint of the angle.
|
177
|
+
* @return {Boolean}
|
178
|
+
* true if the angle is obtuse.
|
179
|
+
*/
|
180
|
+
jsts.algorithm.Angle.isObtuse = function(p0, p1, p2) {
|
181
|
+
var dx0, dy0, dx1, dy1, dotprod;
|
182
|
+
|
183
|
+
//relies on fact that A dot B is negative iff A ang B is obtuse
|
184
|
+
dx0 = p0.x - p1.x;
|
185
|
+
dy0 = p0.y - p1.y;
|
186
|
+
dx1 = p2.x - p1.x;
|
187
|
+
dy1 = p2.y - p1.y;
|
188
|
+
dotprod = dx0 * dx1 + dy0 * dy1;
|
189
|
+
return dotprod < 0;
|
190
|
+
};
|
191
|
+
|
192
|
+
|
193
|
+
/**
|
194
|
+
* Returns the unoriented smallest angle between two vectors.
|
195
|
+
* The computed angle will be in the range [0, Pi).
|
196
|
+
*
|
197
|
+
* @param {jsts.geom.Coordinate}
|
198
|
+
* tip1 the tip of one vector.
|
199
|
+
* @param {jsts.geom.Coordinate}
|
200
|
+
* tail the tail of each vector.
|
201
|
+
* @param {jsts.geom.Coordinate}
|
202
|
+
* tip2 the tip of the other vector.
|
203
|
+
* @return {Number}
|
204
|
+
* the angle between tail-tip1 and tail-tip2.
|
205
|
+
*/
|
206
|
+
jsts.algorithm.Angle.angleBetween = function(tip1, tail, tip2) {
|
207
|
+
var a1, a2;
|
208
|
+
a1 = jsts.algorithm.Angle.angle(tail, tip1);
|
209
|
+
a2 = jsts.algorithm.Angle.angle(tail, tip2);
|
210
|
+
|
211
|
+
return jsts.algorithm.Angle.diff(a1, a2);
|
212
|
+
};
|
213
|
+
|
214
|
+
|
215
|
+
/**
|
216
|
+
* Returns the oriented smallest angle between two vectors.
|
217
|
+
* The computed angle will be in the range (-Pi, Pi].
|
218
|
+
* A positive result corresponds to a counterclockwise rotation
|
219
|
+
* from v1 to v2;
|
220
|
+
* a negative result corresponds to a clockwise rotation.
|
221
|
+
*
|
222
|
+
* @param {jsts.geom.Coordinate}
|
223
|
+
* tip1 the tip of v1.
|
224
|
+
* @param {jsts.geom.Coordinate}
|
225
|
+
* tail the tail of each vector.
|
226
|
+
* @param {jsts.geom.Coordinate}
|
227
|
+
* tip2 the tip of v2.
|
228
|
+
* @return {Number}
|
229
|
+
* the angle between v1 and v2, relative to v1.
|
230
|
+
*/
|
231
|
+
jsts.algorithm.Angle.angleBetweenOriented = function(tip1, tail, tip2) {
|
232
|
+
var a1, a2, angDel;
|
233
|
+
|
234
|
+
a1 = jsts.algorithm.Angle.angle(tail, tip1);
|
235
|
+
a2 = jsts.algorithm.Angle.angle(tail, tip2);
|
236
|
+
angDel = a2 - a1;
|
237
|
+
|
238
|
+
// normalize, maintaining orientation
|
239
|
+
if (angDel <= -Math.PI) {
|
240
|
+
return angDel + jsts.algorithm.Angle.PI_TIMES_2;
|
241
|
+
}
|
242
|
+
if (angDel > Math.PI) {
|
243
|
+
return angDel - jsts.algorithm.Angle.PI_TIMES_2;
|
244
|
+
}
|
245
|
+
return angDel;
|
246
|
+
};
|
247
|
+
|
248
|
+
|
249
|
+
/**
|
250
|
+
* Computes the interior angle between two segments of a ring. The ring is
|
251
|
+
* assumed to be oriented in a clockwise direction. The computed angle will be
|
252
|
+
* in the range [0, 2Pi]
|
253
|
+
*
|
254
|
+
* @param {jsts.geom.Coordinate}
|
255
|
+
* p0 a point of the ring.
|
256
|
+
* @param {jsts.geom.Coordinate}
|
257
|
+
* p1 the next point of the ring.
|
258
|
+
* @param {jsts.geom.Coordinate}
|
259
|
+
* p2 the next point of the ring.
|
260
|
+
* @return {Number}
|
261
|
+
* the interior angle based at <code>p1.</code>
|
262
|
+
*/
|
263
|
+
jsts.algorithm.Angle.interiorAngle = function(p0, p1, p2) {
|
264
|
+
var anglePrev, angleNext;
|
265
|
+
|
266
|
+
anglePrev = jsts.algorithm.Angle.angle(p1, p0);
|
267
|
+
angleNext = jsts.algorithm.Angle.angle(p1, p2);
|
268
|
+
return Math.abs(angleNext - anglePrev);
|
269
|
+
};
|
270
|
+
|
271
|
+
|
272
|
+
/**
|
273
|
+
* Returns whether an angle must turn clockwise or counterclockwise
|
274
|
+
* to overlap another angle.
|
275
|
+
*
|
276
|
+
* @param {Number}
|
277
|
+
* ang1 an angle (in radians).
|
278
|
+
* @param {Number}
|
279
|
+
* ang2 an angle (in radians).
|
280
|
+
* @return {Number}
|
281
|
+
* whether a1 must turn CLOCKWISE, COUNTERCLOCKWISE or NONE to
|
282
|
+
* overlap a2.
|
283
|
+
*/
|
284
|
+
jsts.algorithm.Angle.getTurn = function(ang1, ang2) {
|
285
|
+
var crossproduct = Math.sin(ang2 - ang1);
|
286
|
+
|
287
|
+
if (crossproduct > 0) {
|
288
|
+
return jsts.algorithm.Angle.COUNTERCLOCKWISE;
|
289
|
+
}
|
290
|
+
if (crossproduct < 0) {
|
291
|
+
return jsts.algorithm.Angle.CLOCKWISE;
|
292
|
+
}
|
293
|
+
return jsts.algorithm.Angle.NONE;
|
294
|
+
};
|
295
|
+
|
296
|
+
|
297
|
+
/**
|
298
|
+
* Computes the normalized value of an angle, which is the
|
299
|
+
* equivalent angle in the range ( -Pi, Pi ].
|
300
|
+
*
|
301
|
+
* @param {Number}
|
302
|
+
* angle the angle to normalize.
|
303
|
+
* @return {Number}
|
304
|
+
* an equivalent angle in the range (-Pi, Pi].
|
305
|
+
*/
|
306
|
+
jsts.algorithm.Angle.normalize = function(angle) {
|
307
|
+
while (angle > Math.PI) {
|
308
|
+
angle -= jsts.algorithm.Angle.PI_TIMES_2;
|
309
|
+
}
|
310
|
+
while (angle <= -Math.PI) {
|
311
|
+
angle += jsts.algorithm.Angle.PI_TIMES_2;
|
312
|
+
}
|
313
|
+
return angle;
|
314
|
+
};
|
315
|
+
|
316
|
+
|
317
|
+
/**
|
318
|
+
* Computes the normalized positive value of an angle, which is the
|
319
|
+
* equivalent angle in the range [ 0, 2*Pi ).
|
320
|
+
* E.g.:
|
321
|
+
* <ul>
|
322
|
+
* <li>normalizePositive(0.0) = 0.0
|
323
|
+
* <li>normalizePositive(-PI) = PI
|
324
|
+
* <li>normalizePositive(-2PI) = 0.0
|
325
|
+
* <li>normalizePositive(-3PI) = PI
|
326
|
+
* <li>normalizePositive(-4PI) = 0
|
327
|
+
* <li>normalizePositive(PI) = PI
|
328
|
+
* <li>normalizePositive(2PI) = 0.0
|
329
|
+
* <li>normalizePositive(3PI) = PI
|
330
|
+
* <li>normalizePositive(4PI) = 0.0
|
331
|
+
* </ul>
|
332
|
+
*
|
333
|
+
* @param {Number}
|
334
|
+
* angle the angle to normalize, in radians.
|
335
|
+
* @return {Number}
|
336
|
+
* an equivalent positive angle.
|
337
|
+
*/
|
338
|
+
jsts.algorithm.Angle.normalizePositive = function(angle) {
|
339
|
+
if (angle < 0.0) {
|
340
|
+
while (angle < 0.0) {
|
341
|
+
angle += jsts.algorithm.Angle.PI_TIMES_2;
|
342
|
+
}
|
343
|
+
// in case round-off error bumps the value over
|
344
|
+
if (angle >= jsts.algorithm.Angle.PI_TIMES_2) {
|
345
|
+
angle = 0.0;
|
346
|
+
}
|
347
|
+
}
|
348
|
+
else {
|
349
|
+
while (angle >= jsts.algorithm.Angle.PI_TIMES_2) {
|
350
|
+
angle -= jsts.algorithm.Angle.PI_TIMES_2;
|
351
|
+
}
|
352
|
+
// in case round-off error bumps the value under
|
353
|
+
if (angle < 0.0) {
|
354
|
+
angle = 0.0;
|
355
|
+
}
|
356
|
+
}
|
357
|
+
return angle;
|
358
|
+
};
|
359
|
+
|
360
|
+
|
361
|
+
/**
|
362
|
+
* Computes the unoriented smallest difference between two angles.
|
363
|
+
* The angles are assumed to be normalized to the range [-Pi, Pi].
|
364
|
+
* The result will be in the range [0, Pi].
|
365
|
+
*
|
366
|
+
* @param {Number}
|
367
|
+
* ang1 the angle of one vector (in [-Pi, Pi] ).
|
368
|
+
* @param {Number}
|
369
|
+
* ang2 the angle of the other vector (in range [-Pi, Pi] ).
|
370
|
+
* @return {Number}
|
371
|
+
* the angle (in radians) between the two vectors (in range [0, Pi] ).
|
372
|
+
*/
|
373
|
+
jsts.algorithm.Angle.diff = function(ang1, ang2) {
|
374
|
+
var delAngle;
|
375
|
+
|
376
|
+
if (ang1 < ang2) {
|
377
|
+
delAngle = ang2 - ang1;
|
378
|
+
} else {
|
379
|
+
delAngle = ang1 - ang2;
|
380
|
+
}
|
381
|
+
|
382
|
+
if (delAngle > Math.PI) {
|
383
|
+
delAngle = (2 * Math.PI) - delAngle;
|
384
|
+
}
|
385
|
+
|
386
|
+
return delAngle;
|
387
|
+
};
|