feat: refine complex junction geometry and workbench
This commit is contained in:
1 parent
7c04d086db
commit
05614d1a69
20 files changed
+315
-267
No files matched your search
@@ -1,13 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const { topologyIdentity } = require('./junction-topology');
|
||||
const { normalizeHeading, offsetCoordinate } = require('../geometry/metric');
|
||||
|
||||
const MIN_ENTRY_SECTION_METERS = 12;
|
||||
|
||||
function normalizeHeading(value) {
|
||||
return ((((value + 180) % 360) + 360) % 360) - 180;
|
||||
}
|
||||
|
||||
function averageHeading(headings) {
|
||||
const vector = headings.reduce(
|
||||
(sum, heading) => {
|
||||
@@ -31,16 +28,6 @@ function tangentAt(line, station, length, helpers) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function offsetCoordinate(point, heading, meters) {
|
||||
if (!point || !Number.isFinite(heading)) return null;
|
||||
const radians = (heading * Math.PI) / 180;
|
||||
const lonMeters = 111320 * Math.cos((point[1] * Math.PI) / 180);
|
||||
return [
|
||||
point[0] + (Math.sin(radians) * meters) / Math.max(lonMeters, 1e-9),
|
||||
point[1] + (Math.cos(radians) * meters) / 111320,
|
||||
];
|
||||
}
|
||||
|
||||
function boundaryAt(point, tangent, widthMeters) {
|
||||
const halfWidth = Math.max(0, Number(widthMeters) || 0) / 2;
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user