2002-02-09 14:39:05 -07:00
|
|
|
// sphere.h
|
|
|
|
//
|
|
|
|
// Copyright (C) 2002, Chris Laurel <claurel@shatters.net>
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
|
2021-11-13 14:42:26 -07:00
|
|
|
#pragma once
|
2002-02-09 14:39:05 -07:00
|
|
|
|
2009-07-14 19:05:51 -06:00
|
|
|
#include <Eigen/Core>
|
2002-02-09 14:39:05 -07:00
|
|
|
|
2019-05-16 15:51:11 -06:00
|
|
|
namespace celmath
|
|
|
|
{
|
|
|
|
|
2002-02-09 14:39:05 -07:00
|
|
|
template<class T> class Sphere
|
|
|
|
{
|
|
|
|
public:
|
2009-07-14 19:05:51 -06:00
|
|
|
Sphere() :
|
2021-11-13 14:42:26 -07:00
|
|
|
center(Eigen::Matrix<T, 3, 1>::Zero()),
|
|
|
|
radius(static_cast<T>(1))
|
2009-07-14 19:05:51 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Sphere(T _radius) :
|
2021-11-13 14:42:26 -07:00
|
|
|
center(Eigen::Matrix<T, 3, 1>::Zero()),
|
2009-07-14 19:05:51 -06:00
|
|
|
radius(_radius)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Sphere(const Eigen::Matrix<T, 3, 1> _center, T _radius) :
|
|
|
|
center(_center),
|
|
|
|
radius(_radius)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-02-09 14:39:05 -07:00
|
|
|
public:
|
2009-07-14 19:05:51 -06:00
|
|
|
Eigen::Matrix<T, 3, 1> center;
|
2002-02-09 14:39:05 -07:00
|
|
|
T radius;
|
|
|
|
};
|
|
|
|
|
2021-11-13 14:42:26 -07:00
|
|
|
using Spheref = Sphere<float>;
|
|
|
|
using Sphered = Sphere<double>;
|
2020-03-29 01:35:03 -06:00
|
|
|
} // namespace celmath
|