celestia/src/celmath/sphere.h

46 lines
921 B
C
Raw Normal View History

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.
#pragma once
2002-02-09 14:39:05 -07: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:
Sphere() :
center(Eigen::Matrix<T, 3, 1>::Zero()),
radius(static_cast<T>(1))
{
}
Sphere(T _radius) :
center(Eigen::Matrix<T, 3, 1>::Zero()),
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:
Eigen::Matrix<T, 3, 1> center;
2002-02-09 14:39:05 -07:00
T radius;
};
using Spheref = Sphere<float>;
using Sphered = Sphere<double>;
2020-03-29 01:35:03 -06:00
} // namespace celmath