载入中...
搜索中...
未找到
UrbanCrossField.cpp 文件参考
#include "procgen/urban/UrbanCrossField.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <limits>
#include <numeric>
#include <utility>
#include <vector>
#include "procgen/urban/UrbanGeometry.h"

浏览源代码.

命名空间

namespace  eve
 Build metadata (engine git commit, build time, third-party version).
 
namespace  eve::procgen
 
namespace  eve::procgen::urban
 

函数

std::vector< SplitCandidate > eve::procgen::urban::generateSplitCandidates (const Polygon &poly, int maxCandidates, double minHalfArea)
 Generate candidate streamlines for binary partitioning of poly.
 
double eve::procgen::urban::signedArea (const Polygon &poly)
 Return the raw (possibly negative) signed area of a polygon ring.
 
double eve::procgen::urban::area (const Polygon &poly)
 Absolute polygon area.
 
double eve::procgen::urban::polylineLength (const Polyline &pl)
 Total length of an open polyline.
 
Vec2 eve::procgen::urban::centroid (const Polygon &poly)
 Centroid (area-weighted) of a simple polygon.
 
double eve::procgen::urban::perimeter (const Polygon &poly)
 Perimeter length of a closed ring.
 
bool eve::procgen::urban::ensureCCW (Polygon &poly)
 Ensure the ring is CCW (positive signed area); returns whether it was flipped.
 
void eve::procgen::urban::cleanupRing (Polygon &poly, double eps=1e-9)
 Remove consecutive duplicate points (within eps) and points that create zero spikes.
 
bool eve::procgen::urban::pointInPolygon (const Vec2 &p, const Polygon &poly)
 Point-in-polygon test (ray casting; boundary counts as inside).
 
bool eve::procgen::urban::pointOnSegment (const Vec2 &p, const Vec2 &a, const Vec2 &b, double eps=1e-9)
 True if p lies on segment a-b (within tolerance).
 
bool eve::procgen::urban::segmentsIntersect (const Vec2 &a, const Vec2 &b, const Vec2 &c, const Vec2 &d, Vec2 *out)
 True if the open segments a-b and c-d properly cross; out receives the crossing.
 
bool eve::procgen::urban::segmentIntersectsPolyline (const Vec2 &a, const Vec2 &b, const Polyline &pl)
 True if a segment crosses any segment of an open polyline (excluding shared endpoints).
 
bool eve::procgen::urban::polylineSelfIntersects (const Polyline &pl)
 True if any two non-adjacent segments of the open polyline cross.
 
bool eve::procgen::urban::polygonIsSimple (const Polygon &poly)
 Simple polygon test: no self intersections among non-adjacent ring edges.
 
double eve::procgen::urban::closestPointOnSegment (const Vec2 &p, const Vec2 &a, const Vec2 &b, Vec2 *out)
 Closest point on segment a-b; returns distance and writes out.
 
Vec2 eve::procgen::urban::closestPointOnBoundary (const Polygon &poly, const Vec2 &p, BoundaryPosition *pos)
 Closest point on the polygon boundary; writes edge index + t in [0,1].
 
Vec2 eve::procgen::urban::pointAtBoundaryLength (const Polygon &poly, double s, BoundaryPosition *pos)
 Interpolate the boundary point at arc length s in [0, perimeter).
 
std::vector< BoundarySample > eve::procgen::urban::sampleBoundary (const Polygon &poly, int count)
 Uniformly sample the polygon boundary (approx. count samples, at least 8). Samples are ordered along the boundary; each stores the tangent angle in radians.
 
double eve::procgen::urban::includedAngleDeg (const Vec2 &u, const Vec2 &v)
 Included angle in degrees at the shared vertex between edge u (prev->shared) and v (shared->next), in [0,180].
 
bool eve::procgen::urban::isCollinear (const Vec2 &prev, const Vec2 &shared, const Vec2 &next)
 True when two consecutive edges are considered collinear (included angle > 135°).
 
Polygon eve::procgen::urban::approximatePolygon (const Polygon &ring)
 Simplify a ring to its approximate polygon: consecutive edges with included angle > 135° are merged into a single side (paper Section 3).
 
double eve::procgen::urban::shapeIrregularity (const Polygon &approxRing, double gammaAngle=0.75, double gammaSide=0.25)
 Shape irregularity metric of Eq. (1) over the approximate polygon: I = γ1·(1/N)·Σ(θi−θ̄)² + γ2·(1/(N·l̄²))·Σ(li−l̄)². Smaller is more regular; 0 for an ideal regular polygon.
 
bool eve::procgen::urban::splitPolygonByPolyline (const Polygon &poly, const Polyline &split, const BoundaryPosition &posA, const BoundaryPosition &posB, Polygon &outA, Polygon &outB)
 Split a CCW simple polygon by a polyline whose endpoints lie on the boundary and whose interior points are strictly inside the polygon. split goes from boundary point A to boundary point B; the two resulting CCW rings are returned in outA/outB. Returns false on degenerate input. Callers verify area constraints afterwards.
 
bool eve::procgen::urban::validSplit (const Polygon &poly, const Polyline &split, double minHalfArea, Polygon *outA, Polygon *outB, double *fracA)
 Validity of a candidate split: both halves simple, positive area, inside the original.
 
bool eve::procgen::urban::triangulatePolygon (const Polygon &poly, std::vector< int > &outTriangles)
 Triangulate a simple polygon by ear clipping; returns CCW triangles (3*i..3*i+2).
 
double eve::procgen::urban::distanceToSegment (const Vec2 &p, const Vec2 &a, const Vec2 &b)
 Raster helper: does the pixel-center fall within eps of segment a-b?
 

变量说明

◆ inside

◆ nx

int nx = 0

在文件 UrbanCrossField.cpp 第 19 行定义.

◆ ny

int ny = 0

在文件 UrbanCrossField.cpp 第 20 行定义.

◆ ox

double ox = 0.0

在文件 UrbanCrossField.cpp 第 21 行定义.

被这些函数引用 eve::procgen::applyTerrainObjectsMultiTile(), eve::procgen::applyTerrainTreesMultiTile(), eve::avatar::AvatarInstance::attachToBone(), eve::editor::GizmoManager::beginDrag(), eve::editor::TransformGizmo::beginDrag(), eve::procgen::NoiseField::billowPerlin(), eve::map::Fov::Impl::buildOpaqueRects(), eve::map::Fov::Impl::castLight(), eve::map::Fov::Impl::castRayLine(), eve::procgen::CloudShadow::cloudOffset(), eve::sensing::SensingWorld::collectCandidates(), eve::map::Fov::Impl::computeRectangle(), eve::procgen::CloudShadow::coverageAt(), eve::building_editing::BuildingPlacementTarget::curveLogicalPointFromWorld(), eve::avatar::AvatarInstance::defineEquipmentVisual3D(), eve::animation::AnimLattice::deformPositions(), eve::graphics::RenderSystem::drawItems(), eve::map::Map::dualGridOffsetX(), eve::map::Map::dualGridOffsetY(), eve::building_editing::BuildingPlacementTarget::edgeCubicBezierGizmo(), eve::procgen::TerrainPipeline::erodeFluvialDetailed(), eve::procgen::evolveSurface(), eve::voxel_editor::exposeVoxelCatalogEditorScriptBindings(), eve::math::Math::fbmColor2(), eve::procgen::NoiseField::fbmPerlin(), eve::procgen::NoiseField::fbmSimplex(), eve::physics::GeometryCollectionInstanceSnapshot::fromValue(), eve::procgen::NoiseField::gabor(), eve::math::Math::gabor2(), eve::procgen::urban::generateUrbanGrid(), eve::animation::AnimLattice::getPointOffsetX(), eve::map::Fov::Impl::hexCellAngle(), eve::procgen::NoiseField::hexDistance(), eve::map::Fov::Impl::inRadius2(), eve::map::Fov::Impl::inRadius3(), eve::card::CardPlaneMapper::mapRay(), eve::animation::multiplyQuat(), eve::image::ImageData::paintCircleUv(), eve::map::Fov::Impl::passesHeightToTarget(), eve::editor::GizmoManager::pick(), eve::editor::TransformGizmo::pick(), eve::scene::Scene::pickRayAt(), eve::voxel_editing::pickVoxelModel(), eve::voxel_editor::VoxelCatalogEditor::pointerDown(), eve::voxel_editor::VoxelCatalogEditor::pointerWorldRay(), eve::procgen::poissonDiskPoints(), eve::level_editing::Brush::previewAt(), eve::physics::PhysicsArtifactProvider::rayCast(), eve::voxel::VoxelWorld::raycast(), eve::math::Math::raycastBox(), eve::math::Math::raycastCircle2(), eve::math::Math::raycastPlane(), eve::math::Math::raycastRect2(), eve::voxel::VoxelWorld::raycastScript(), eve::math::Math::raycastSphere(), eve::fluids::OceanWake::recenter(), eve::procgen::GtsTerrainLodRuntime::replace(), eve::procgen_physics::GtsTerrainColliderRuntime::replace(), eve::procgen::GtsTerrainLodRuntime::replaceAndHideSource(), eve::npc_ai::DecisionContext::restoreJson(), eve::procgen::NoiseField::ridgedPerlin(), eve::animation::AnimTrail::sampleBoneOffset(), eve::building::PlacementSystem::sampleEdgeCurveSurface(), eve::procgen::gridgraph::select(), eve::animation::AnimTrail::setDrawOffset(), eve::avatar::AvatarInstance::setLayerOffset(), eve::animation::AnimLattice::setOrigin(), eve::card::CardPlaneMapper::setPlane(), eve::animation::AnimSkin::skinPositions(), eve::animation::slerpQuat(), eve::card::Hand::slotTransform(), eve::particles::spawnParticleAt(), eve::graphics::texBombHash22(), eve::graphics::texCellBombSampleUV(), eve::animation::Mat4::transformPoint(), eve::map::Fov::Impl::tryMark2(), eve::editor::GizmoManager::updateDrag(), eve::editor::TransformGizmo::updateDrag(), eve::graphics::Volumetric::uploadFroxel() , 以及 eve::pixelworld::PixelWorld::Impl::wakeAround().

◆ oy

double oy = 0.0

在文件 UrbanCrossField.cpp 第 22 行定义.

被这些函数引用 eve::procgen::applyTerrainTreesMultiTile(), eve::avatar::AvatarInstance::attachToBone(), eve::editor::GizmoManager::beginDrag(), eve::editor::TransformGizmo::beginDrag(), eve::procgen::NoiseField::billowPerlin(), eve::map::Fov::Impl::buildOpaqueRects(), eve::map::Fov::Impl::castLight(), eve::map::Fov::Impl::castRayLine(), eve::sensing::SensingWorld::collectCandidates(), eve::map::Fov::Impl::computeRectangle(), eve::building_editing::BuildingPlacementTarget::curveLogicalPointFromWorld(), eve::avatar::AvatarInstance::defineEquipmentVisual3D(), eve::animation::AnimLattice::deformPositions(), eve::graphics::RenderSystem::drawItems(), eve::map::Map::dualGridOffsetX(), eve::map::Map::dualGridOffsetY(), eve::building_editing::BuildingPlacementTarget::edgeCubicBezierGizmo(), eve::procgen::TerrainPipeline::erodeFluvialDetailed(), eve::procgen::evolveSurface(), eve::voxel_editor::exposeVoxelCatalogEditorScriptBindings(), eve::math::Math::fbmColor2(), eve::procgen::NoiseField::fbmPerlin(), eve::procgen::NoiseField::fbmSimplex(), eve::physics::GeometryCollectionInstanceSnapshot::fromValue(), eve::procgen::NoiseField::gabor(), eve::math::Math::gabor2(), eve::procgen::urban::generateUrbanGrid(), eve::animation::AnimLattice::getPointOffsetY(), eve::map::Fov::Impl::hexCellAngle(), eve::procgen::NoiseField::hexDistance(), eve::map::Fov::Impl::inRadius2(), eve::map::Fov::Impl::inRadius3(), eve::card::CardPlaneMapper::mapRay(), eve::animation::multiplyQuat(), eve::image::ImageData::paintCircleUv(), eve::map::Fov::Impl::passesHeightToTarget(), eve::editor::GizmoManager::pick(), eve::editor::TransformGizmo::pick(), eve::scene::Scene::pickRayAt(), eve::voxel_editing::pickVoxelModel(), eve::voxel_editor::VoxelCatalogEditor::pointerDown(), eve::voxel_editor::VoxelCatalogEditor::pointerWorldRay(), eve::procgen::poissonDiskPoints(), eve::level_editing::Brush::previewAt(), eve::physics::PhysicsArtifactProvider::rayCast(), eve::voxel::VoxelWorld::raycast(), eve::math::Math::raycastBox(), eve::math::Math::raycastCircle2(), eve::math::Math::raycastPlane(), eve::math::Math::raycastRect2(), eve::voxel::VoxelWorld::raycastScript(), eve::math::Math::raycastSphere(), eve::procgen::GtsTerrainLodRuntime::replace(), eve::procgen_physics::GtsTerrainColliderRuntime::replace(), eve::procgen::GtsTerrainLodRuntime::replaceAndHideSource(), eve::npc_ai::DecisionContext::restoreJson(), eve::procgen::NoiseField::ridgedPerlin(), eve::animation::AnimTrail::sampleBoneOffset(), eve::building::PlacementSystem::sampleEdgeCurveSurface(), eve::procgen::gridgraph::select(), eve::animation::AnimTrail::setDrawOffset(), eve::avatar::AvatarInstance::setLayerOffset(), eve::animation::AnimLattice::setOrigin(), eve::card::CardPlaneMapper::setPlane(), eve::animation::AnimSkin::skinPositions(), eve::animation::slerpQuat(), eve::card::Hand::slotTransform(), eve::particles::spawnParticleAt(), eve::graphics::texBombHash22(), eve::graphics::texCellBombSampleUV(), eve::animation::Mat4::transformPoint(), eve::map::Fov::Impl::tryMark2(), eve::editor::GizmoManager::updateDrag(), eve::editor::TransformGizmo::updateDrag(), eve::graphics::Volumetric::uploadFroxel() , 以及 eve::pixelworld::PixelWorld::Impl::wakeAround().

◆ phi

◆ spacing

double spacing = 1.0

在文件 UrbanCrossField.cpp 第 23 行定义.