# Professional Algorithms
# Requirements
"Can we take several sets of 3D coordinates (or 3D polylines drawn in CAD), give a cross-section shape, and directly generate 3D pipes?"
For example, the original CAD drawing is as follows:

The required 3D pipe effect generated automatically by obtaining 3D line coordinate data with threejs is as follows:

# Behind the Scenes
If you directly use THREE.TubeGeometry in threejs to draw each line, gaps will appear at intersections, as shown below:

How to solve the gap problem at intersections became a challenge.
Searching online, I found similar issues in the energy industry—"3D automatic modeling of mine roadways" is a hot topic, with many master's and doctoral students researching it.
So I spent a few yuan on Taobao for a 90-day literature download account and began the process of downloading papers, studying them, and researching algorithms...

After many days of research, few papers explained the entire algorithm flow thoroughly—they only gave a general principle, with details left for you to figure out...
Until I accidentally found a professional book 3D Mine Roadway Network Modeling and Spatial Network Analysis


After reading it, I was inspired. Using the "half-roadway model" to handle intersections and optimizing some details, I finally achieved satisfactory results.

Online demo: https://vjmap.com/map3d/demo/#/demo/map/builtin/objects/03builtinobjtubepathauto (opens new window)
# 3D Personnel Positioning System (Example Open Source)
After solving the above challenge, many applications can be developed based on 3D roadways, such as a "3D personnel positioning system."
Implemented features:
Parse 3D polyline objects in CAD drawings to obtain 3D line coordinates (CAD source: https://vjmap.com/app/cloud/#/map/sys_tube?version=v1&mapopenway=GeomRender&vector=false (opens new window))
Automatically build topology from 3D line coordinates. (Because drawing is done as a single line, it needs to be processed into node-based relationship analysis for intersections)
Automatically generate 3D roadways and handle intersections from data
Simulate personnel movement data and display personnel positions in real time on the 3D map
Click on personnel to view details
View personnel history tracks
Automatically find the nearest exit from a given coordinate
Implementation effect:



This example code is open source. Visit https://vjmap.com/effect/person/ (opens new window) to view it online.
More examples: https://vjmap.com/map3d/example.html (opens new window)