25 lines
786 B
C++
25 lines
786 B
C++
#pragma once
|
|
#include "vde/core/point.h"
|
|
#include <vector>
|
|
|
|
namespace vde::curves {
|
|
|
|
class BezierSurface {
|
|
public:
|
|
BezierSurface(std::vector<std::vector<Point3D>> control_grid);
|
|
|
|
[[nodiscard]] Point3D evaluate(double u, double v) const;
|
|
[[nodiscard]] Vector3D derivative_u(double u, double v) const;
|
|
[[nodiscard]] Vector3D derivative_v(double u, double v) const;
|
|
[[nodiscard]] Vector3D normal(double u, double v) const;
|
|
|
|
[[nodiscard]] int degree_u() const { return static_cast<int>(cp_.size()) - 1; }
|
|
[[nodiscard]] int degree_v() const { return static_cast<int>(cp_[0].size()) - 1; }
|
|
|
|
private:
|
|
std::vector<std::vector<Point3D>> cp_;
|
|
[[nodiscard]] Point3D de_casteljau(double t, const std::vector<Point3D>& pts) const;
|
|
};
|
|
|
|
} // namespace vde::curves
|