// Copyright 2024 SquareBlock Inc. All Rights Reserved.
// Author: tianlei.richard@qq.com (tianlei.richard)

#pragma once

#include "common.h"
#include <array>
#include <vector>

class Triangle {
public:
  Triangle(const Point3d &a, unsigned int idx_a, const Point3d &b,
           unsigned int idx_b, const Point3d &c, unsigned int idx_c);
  Triangle(const std::vector<std::shared_ptr<Vertex>> &vertices,
           unsigned int idx_a, unsigned int idx_b, unsigned int idx_c);

public:
  std::vector<unsigned int> get_vertex_index() const;
  std::vector<Point3d> get_vertex_position() const;
  void set_points(const std::vector<Point3d> &points);

public:
  BBox axis_align_bbox() const;
  Vector3d normal_vector() const;

private:
  std::array<unsigned int, 3> indices_;
  std::array<Point3d, 3> vertices_;
};
