#ifndef COLOR_RAMP_H
#define COLOR_RAMP_H
class Color_ramp
typedef std::array<unsigned char, 3> Color;
typedef std::pair<double, Color> Step;
std::vector<Step> m_steps;
public:
Color_ramp()
m_steps.push_back (std::make_pair (0, Color{ 192, 192, 255}));
m_steps.push_back (std::make_pair (0.2, Color{ 0, 0, 255}));
m_steps.push_back (std::make_pair (0.4, Color{ 0, 255, 0}));
m_steps.push_back (std::make_pair (0.6, Color{ 255, 255, 0}));
m_steps.push_back (std::make_pair (0.8, Color{ 255, 0, 0}));
m_steps.push_back (std::make_pair (1.0, Color{ 128, 0, 0}));
Color get (double value) const
std::size_t idx = 0;
while (m_steps[idx+1].first < value)
++ idx;
double v0 = m_steps[idx].first;
double v1 = m_steps[idx+1].first;
const Color& c0 = m_steps[idx].second;
const Color& c1 = m_steps[idx+1].second;
double ratio = (value - v0) / (v1 - v0);
Color out;
for (std::size_t i = 0; i < 3; ++ i)
out[i] = static_cast<unsigned char>((1 - ratio) * c0[i] + ratio * c1[i]);
return out;
#endif
las是点云数据常见的存储格式,摄影测量和激光雷达数据均采用此格式,点云数据常用来生成等高线,地籍测量,土方量计算等。本文讲解在ArcGIS平台上生成等高线,等高线平滑,并转换为dwg格式供CASS使用。
文章目录一、创建las数据集二、las生成等高线方法1:点云las→不规则三角网tin→栅格→等高线方法2:点云las→栅格→等高线三、等高线格式转换输出
一、创建las数据集
扩展阅读:ArcGIS10.6创建LAS数据集的两种方法并加载点.
```c++
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/intersections.h>
#include <vector>
#include <iostream>
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef K::Point_3 Point;
typedef K::Triangle_3 Triangle;
int main()
// 输入两组点云数据
std::vector<Point> points1 = {Point(, , ), Point(1, , ), Point(, 1, )};
std::vector<Point> points2 = {Point(.5, .5, ), Point(1.5, .5, ), Point(.5, 1.5, )};
// 构造三角形
Triangle tri1(points1[], points1[1], points1[2]);
Triangle tri2(points2[], points2[1], points2[2]);
// 计算交集
auto result = CGAL::intersection(tri1, tri2);
if (result) {
// 如果有交集,输出交集面积
std::cout << "交集面积为:" << result->area() << std::endl;
} else {
std::cout << "两者没有交集" << std::endl;
return ;
这个代码使用了 CGAL 的精确计算库,可以保证计算结果的精度。