载入中...
搜索中...
未找到
RoadAuthoring.cpp
浏览该文件的文档.
19bool isOnSegment(const RoadProfilePoint& a, const RoadProfilePoint& b, const RoadProfilePoint& p) {
24bool isIntersecting(const RoadProfilePoint& a, const RoadProfilePoint& b, const RoadProfilePoint& c,
31 return std::isfinite(start) && std::isfinite(end) && start >= 0.f && end <= 1.f && end - start > 1e-5f;
57 item.portalStartLength = std::max(0.f, original.portalStartLength - (a - original.start) * pathLength);
58 item.portalEndLength = std::max(0.f, original.portalEndLength - (original.end - b) * pathLength);
111 if (!std::isfinite(policy.blendDistance) || policy.blendDistance < 0.f || !std::isfinite(policy.maxVerticalDelta) ||
112 policy.maxVerticalDelta < 0.f || policy.splatLayer < -1 || !std::isfinite(policy.splatOpacity) ||
121 if (terrain.mode > RoadSideTerrainMode::Average || terrain.alignment > RoadSideAlignment::PathNormal ||
123 !std::isfinite(terrain.maxSide) || !std::isfinite(terrain.minForward) || !std::isfinite(terrain.maxForward) ||
129 (style.samplingPolicy == RoadSamplingPolicy::ParametricDistanceTurn && style.samplingAngleDegrees < 1.f))
133 style.samplingAngleDegrees > 180.f || style.crossSectionSubdivisions < 1 || style.crossSectionSubdivisions > 32)
135 if (style.rollInterpolation > RoadRollInterpolation::SmoothStep) return invalid("unknown roll interpolation");
136 if (style.widthInterpolation > RoadWidthInterpolation::CatmullRom) return invalid("unknown width interpolation");
137 if (style.frameOrientation > RoadFrameOrientation::WorldUp) return invalid("unknown frame orientation");
138 if (style.crossSection.empty() && style.crossSectionClosed) return invalid("closed flag needs a custom section");
147 if (!isValidInterval(item.start, item.end) || item.start < previous || item.kind > RoadStructureKind::Tunnel ||
150 item.portalStartLength < 0.f || item.portalEndLength < 0.f || item.portalStartLength > 10000.f ||
151 item.portalEndLength > 10000.f || !std::isfinite(item.wallThickness) || item.wallThickness <= 0.f ||
154 float maximumHeight = style.crossSection.empty() ? std::max(style.curbHeight, style.sidewalkHeight) : 0.f;
211Result<std::pair<RoadStyle, RoadStyle>> splitRoadAuthoring(const RoadEdge& edge, std::size_t pointIndex) {
236 std::sqrt(std::pow(sample.value().x - previous.x, 2.f) + std::pow(sample.value().y - previous.y, 2.f) +
255 const std::size_t count = style.crossSectionClosed ? style.crossSection.size() : style.crossSection.size() - 1;
Strong identity values shared by persistence, content and logical-name APIs.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Owning multi-segment 3D spline with deterministic bounded sampling.
Definition SplinePath.h:118
Result< void > setKindResult(std::string_view kind)
Select linear, catmullRom, quadraticBezier, or cubic bezier interpolation.
Definition SplinePath.cpp:88
void reverseFacilityPrefab(RoadFacilityPrefab &prefab)
Reflect an owned prefab into reverse traversal coordinates, including its segment sequence/window.
Definition RoadAuthoring.cpp:193
float roadSurfaceHeight(const RoadStyle &style, float lateral)
Return custom asphalt height at one unscaled driving lateral position.
Definition RoadAuthoring.cpp:253
Result< void > validateFacilityPrefab(const RoadFacilityPrefab &prefab)
Validate finite source mesh topology and bounded source ranges.
Definition RoadFacilityPrefab.cpp:42
void reverseSectionGeometry(std::vector< RoadProfilePoint > §ion, bool closed)
Reflect an owning section and preserve outgoing segment semantics.
Definition RoadAuthoring.cpp:65
Result< void > validateSection(const std::vector< RoadProfilePoint > &points, bool closed)
Validate bounded simple section geometry and semantic material tags.
Definition RoadAuthoring.cpp:78
void reverseRoadAuthoring(RoadStyle &style)
Reflect section and interval authoring while preserving physical placement.
Definition RoadAuthoring.cpp:174
Result< void > validateRoadAuthoring(const RoadStyle &style)
Validate structural intervals and continuous-facility authoring.
Definition RoadAuthoring.cpp:109
Result< std::pair< RoadStyle, RoadStyle > > splitRoadAuthoring(const RoadEdge &edge, std::size_t pointIndex)
Clip/remap normalized arc intervals into owning first/second styles.
Definition RoadAuthoring.cpp:211
@ ParametricDistanceTurn
@ TunnelPortalAsphalt
Driving surface inside an authored tunnel portal footprint.
@ InvalidArgument
@ ReplaceTranslationRotation
@ Authored
One spline anchor with incoming and outgoing handle offsets.
Definition SplinePath.h:25
Evaluated spline position and normalized tangent.
Definition SplinePath.h:49
Directed centerline edge with optional reverse lanes.
Definition RoadTypes.h:286
Owned prefab mesh; local Z in [0,length] deforms along the facility arc. Source range preserves cut g...
Definition RoadTypes.h:94
Owning cross-section, width policy and structural authoring for one road edge.
Definition RoadTypes.h:182
std::vector< RoadProfilePoint > crossSection
Empty selects the standard road; custom segment tags are explicit.
Definition RoadTypes.h:192
float samplingSpacingMeters
New roads use the measured 2m trigger; explicit zero keeps legacy fixed counts.
Definition RoadTypes.h:221
int crossSectionSubdivisions
Subdivide every authored section segment, bounded to [1,32].
Definition RoadTypes.h:224
std::vector< RoadStructureInterval > structures
Explicit normalized arc intervals; nonempty disables legacy automatic structures.
Definition RoadTypes.h:196
RoadSideTerrainRule sideTerrain
Terrain height selection for side.left/right anchors only.
Definition RoadTypes.h:184
std::vector< RoadContinuousFacility > facilities
Continuous swept facilities, clipped by sockets.
Definition RoadTypes.h:197
RoadFrameOrientation frameOrientation
New roads retain horizontal unbanked sections.
Definition RoadTypes.h:187
RoadRollInterpolation rollInterpolation
New roads ease crossfall per spline span; old snapshots retain Linear.
Definition RoadTypes.h:185
RoadSamplingPolicy samplingPolicy
Definition RoadTypes.h:225
float samplingAngleDegrees
New roads match the reference 45 degree target; scan requires >=1.
Definition RoadTypes.h:223
RoadWidthInterpolation widthInterpolation
Definition RoadTypes.h:189
RoadTerrainPolicy terrainPolicy
Authoritative ground-channel policy; execution remains explicit.
Definition RoadTypes.h:228