// Copyright 2024 Bytedance Inc. All Rights Reserved. // Author: tianlei.richard@qq.com (tianlei.richard) #pragma once #include "common.h" #include #include class Triangle { public: using AffineTransformType = Eigen::Transform; using ProjectiveTransformType = Eigen::Transform; private: using HomoPointType = Eigen::Vector4d; public: Triangle(const Point3d &a, const Point3d &b, const Point3d &c); Triangle(const HomoPointType &a, const HomoPointType &b, const HomoPointType &c); template std::array, 3> get_points() const { return std::array, 3>{ (points_[0]).head(size), (points_[1]).head(size), (points_[2]).head(size), }; } public: BBox axis_align_bbox() const; Vector3d normal_vector() const; void affine_transform(const AffineTransformType &m); void projective_transform(const ProjectiveTransformType &m); private: std::array points_; };