📄 function_objects.h
字号:
operator()( const Point_3& p, const Point_3& q) const { typedef typename K::FT FT; return squared_distance(p, q) / FT(4); } // FIXME FT operator()( const Point_3& p, const Point_3& q, const Point_3& r) const { return squared_distance(p, circumcenter(p, q, r)); } // FIXME FT operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { return squared_distance(p, circumcenter(p, q, r, s)); } // FIXME }; template <typename K> class Compute_volume_3 { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; public: typedef FT result_type; typedef Arity_tag< 1 > Arity; FT operator()(const Point_3& p0, const Point_3& p1, const Point_3& p2, const Point_3& p3) const { Vector_3 vec1 = p1 - p0; Vector_3 vec2 = p2 - p0; Vector_3 vec3 = p3 - p0; // first compute (vec1.hw * vec2.hw * vec3.hw * det(vec1, vec2, vec3)) // then divide by (6 * vec1.hw * vec2.hw * vec3.hw) const FT w123 (vec1.hw() * vec2.hw() * vec3.hw()); const FT& hx1 = vec1.hx(); const FT& hy1 = vec1.hy(); const FT& hz1 = vec1.hz(); const FT& hx2 = vec2.hx(); const FT& hy2 = vec2.hy(); const FT& hz2 = vec2.hz(); const FT& hx3 = vec3.hx(); const FT& hy3 = vec3.hy(); const FT& hz3 = vec3.hz(); return ( (hx1 * (hy2 * hz3 - hy3 * hz2)) - (hy1 * (hx2 * hz3 - hx3 * hz2)) + (hz1 * (hx2 * hy3 - hx3 * hy2)))/ (6 * w123); } FT operator()( const Tetrahedron_3& t ) const { return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2), t.vertex(3)); } FT operator()( const Iso_cuboid_3& c ) const { return c.rep().volume(); } }; template <typename K> class Compute_x_2 { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: typedef FT result_type; typedef Arity_tag< 1 > Arity; FT operator()(const Point_2& p) const { return p.rep().x(); } FT operator()(const Vector_2& v) const { return v.rep().x(); } }; template <typename K> class Compute_x_3 { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: typedef FT result_type; typedef Arity_tag< 1 > Arity; FT operator()(const Point_3& p) const { return p.rep().x(); } FT operator()(const Vector_3& v) const { return v.rep().x(); } }; template <typename K> class Compute_y_2 { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: typedef FT result_type; typedef Arity_tag< 1 > Arity; FT operator()(const Point_2& p) const { return p.rep().y(); } FT operator()(const Vector_2& v) const { return v.rep().y(); } }; template <typename K> class Compute_y_3 { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: typedef FT result_type; typedef Arity_tag< 1 > Arity; FT operator()(const Point_3& p) const { return p.rep().y(); } FT operator()(const Vector_3& v) const { return v.rep().y(); } }; template <typename K> class Compute_z_3 { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: typedef FT result_type; typedef Arity_tag< 1 > Arity; FT operator()(const Point_3& p) const { return p.rep().z(); } FT operator()(const Vector_3& v) const { return v.rep().z(); } }; template <typename K> class Compute_dx_2 : public Has_qrt { typedef typename K::RT RT; typedef typename K::Direction_2 Direction_2; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Direction_2& d) const { return d.rep().dx(); } }; template <typename K> class Compute_dx_3 : public Has_qrt { typedef typename K::RT RT; typedef typename K::Direction_3 Direction_3; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Direction_3& d) const { return d.rep().dx(); } }; template <typename K> class Compute_dy_2 : public Has_qrt { typedef typename K::RT RT; typedef typename K::Direction_2 Direction_2; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Direction_2& d) const { return d.rep().dy(); } }; template <typename K> class Compute_dy_3 : public Has_qrt { typedef typename K::RT RT; typedef typename K::Direction_3 Direction_3; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Direction_3& d) const { return d.rep().dy(); } }; template <typename K> class Compute_dz_3 : public Has_qrt { typedef typename K::RT RT; typedef typename K::Direction_3 Direction_3; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Direction_3& d) const { return d.rep().dz(); } }; template <typename K> class Compute_hx_2 : public Has_qrt { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Point_2& p) const { return p.rep().hx(); } const result_type & operator()(const Vector_2& v) const { return v.rep().hx(); } }; template <typename K> class Compute_hx_3 : public Has_qrt { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Point_3& p) const { return p.rep().hx(); } const result_type & operator()(const Vector_3& v) const { return v.rep().hx(); } }; template <typename K> class Compute_hy_2 : public Has_qrt { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Point_2& p) const { return p.rep().hy(); } const result_type & operator()(const Vector_2& v) const { return v.rep().hy(); } }; template <typename K> class Compute_hy_3 : public Has_qrt { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Point_3& p) const { return p.rep().hy(); } const result_type & operator()(const Vector_3& v) const { return v.rep().hy(); } }; template <typename K> class Compute_hz_3 : public Has_qrt { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Point_3& p) const { return p.rep().hz(); } const result_type & operator()(const Vector_3& v) const { return v.rep().hz(); } }; template <typename K> class Compute_hw_2 : public Has_qrt { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Point_2& p) const { return p.rep().hw(); } const result_type & operator()(const Vector_2& v) const { return v.rep().hw(); } }; template <typename K> class Compute_hw_3 : public Has_qrt { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: typedef RT result_type; typedef Arity_tag< 1 > Arity; const result_type & operator()(const Point_3& p) const { return p.rep().hw(); } const result_type & operator()(const Vector_3& v) const { return v.rep().hw(); } }; template <typename K> class Construct_base_vector_3 { typedef typename K::Vector_3 Vector_3; typedef typename K::Plane_3 Plane_3; typedef typename K::RT RT; typedef typename K::Construct_orthogonal_vector_3 Construct_orthogonal_vector_3; Construct_orthogonal_vector_3 co; public: typedef Vector_3 result_type;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -