Cumulia Illustrator Rendering Engine v1.0.0
A Rendering engine for industrial CAD/CAE model and optimized for greatest performance
 
Loading...
Searching...
No Matches
spline.h
1//##################################################################################################
2//
3// Copyright (c) 2024 Beijing Qiongqi Tech Co.,Ltd. All rights reserved.
4
5// This source code is confidential and proprietary to Beijing Qiongqi Tech Co.,Ltd(The Holder).
6// Any unauthorized use, copying, modification, or distribution of the code is strictly prohibited.
7// Any user shall obtain authorizaition from the Holder before modifying the source code. And the user shall not
8// sublicense, sell, distribute, or transfer the source code, whether in original or modified form, to any third party
9// without the prior written consent of the Holder.
10
11// This copyright notice and permission grant shall be included in all copies or substantial portions of the source code.
12
13// Author Cumulia Illustrator
14// Date 2024-05-01
15// Version V1.0.0
16//##################################################################################################
17
18#pragma once
19
20#include <cilcore.h>
21#include <vector>
22
23
24namespace cil
25{
26
28 {
29 public:
30 std::vector<Vector3f> control_points; // 控制点
31 std::vector<float> knot_vector; // 结点向量
32 int degree; // 曲线次数
33
34 enum class Boundary
35 {
36 OPEN,
37 CLOSED,
39 };
41
42 //Constructor
43
45
46 BSplineCurve(std::vector<Vector3f> points, int k = 3, Boundary bound = BSplineCurve::Boundary::CLAMPED);
47 // 计算基函数值
48 float BasisFunction(int i, int k, float u);
49
50 // 计算B 样条曲线上的点
52 };
53
55 {
56 public:
57 std::vector<Vector3f> fit_points; // 插值点
58
59 FitBSplineCurve(std::vector<Vector3f> points, Boundary bound = BSplineCurve::Boundary::CLAMPED);
60
61 // 计算端点的斜率
62 void BesselTanget(const Vector3f& p0,const Vector3f& p1,const Vector3f& p2,
63 Vector3f& p0deriv,Vector3f& p1deriv,Vector3f& p2deriv);
64
65 };
66
67 std::shared_ptr<Geometry> _spline(const std::vector<Vector3f> control_points, int degree, BSplineCurve::Boundary boundary, const int slices);
68 std::shared_ptr<Geometry> _spline_fit(const std::vector<Vector3f> fit_points, BSplineCurve::Boundary boundary, const int slices);
69}
Definition spline.h:28
std::vector< Vector3f > control_points
Definition spline.h:30
Boundary
Definition spline.h:35
BSplineCurve(std::vector< Vector3f > points, int k=3, Boundary bound=BSplineCurve::Boundary::CLAMPED)
Vector3f CalculatePoint(float u)
int degree
Definition spline.h:32
Boundary boundary
Definition spline.h:40
std::vector< float > knot_vector
Definition spline.h:31
float BasisFunction(int i, int k, float u)
Definition spline.h:55
void BesselTanget(const Vector3f &p0, const Vector3f &p1, const Vector3f &p2, Vector3f &p0deriv, Vector3f &p1deriv, Vector3f &p2deriv)
std::vector< Vector3f > fit_points
Definition spline.h:57
FitBSplineCurve(std::vector< Vector3f > points, Boundary bound=BSplineCurve::Boundary::CLAMPED)
The class Vector3f inherits from the templated class of Vector3, and the template parameters are spec...
Definition vector.h:322
Definition decal.h:23
std::shared_ptr< Geometry > _spline(const std::vector< Vector3f > control_points, int degree, BSplineCurve::Boundary boundary, const int slices)
std::shared_ptr< Geometry > _spline_fit(const std::vector< Vector3f > fit_points, BSplineCurve::Boundary boundary, const int slices)