---
title: Professional Algorithms
source: https://vjmap.com/en/guide/special.html
---

# 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:

![image-20240822194655787](https://vjmap.com/blogimages/202408221946821.png)

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

![image-20240822194923933](https://vjmap.com/blogimages/202408221949004.png)



## Behind the Scenes

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

![image-20240822195608479](https://vjmap.com/blogimages/202408221956541.png)

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...

![image-20240822200613545](https://vjmap.com/blogimages/202408222006587.png)

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*

![image-20240822201446618](https://vjmap.com/blogimages/202408222014711.png)

![image-20240822201538076](https://vjmap.com/blogimages/202408222015186.png)

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

![image-20240822201805360](https://vjmap.com/blogimages/202408222018422.png)

Online demo: [https://vjmap.com/map3d/demo/#/demo/map/builtin/objects/03builtinobjtubepathauto](https://vjmap.com/map3d/demo/#/demo/map/builtin/objects/03builtinobjtubepathauto)



## 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](https://vjmap.com/app/cloud/#/map/sys_tube?version=v1&mapopenway=GeomRender&vector=false))
- 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:

![image-20240822202414719](https://vjmap.com/blogimages/202408222024792.png)

![image-20240822202514515](https://vjmap.com/blogimages/202408222025583.png)

![image-20240822202548702](https://vjmap.com/blogimages/202408222025823.png)

This example code is open source. Visit [https://vjmap.com/effect/person/](https://vjmap.com/effect/person/) to view it online.

More examples: [https://vjmap.com/map3d/example.html](https://vjmap.com/map3d/example.html)


