/**************************************************************************** * VCGLib o o * * Visual and Computer Graphics Library o o * * _ O _ * * Copyright(C) 2004 \/)\/ * * Visual Computing Lab /\/| * * ISTI - Italian National Research Council | * * \ * * All rights reserved. * * * * 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. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * for more details. * * * ****************************************************************************/ #ifndef VCG_USE_EIGEN #include "deprecated_point.h" #else #ifndef __VCGLIB_POINT #define __VCGLIB_POINT #include "../math/eigen.h" #include #include namespace vcg { template class Point2; template class Point3; template class Point4; namespace ndim{ template class Point; } } namespace vcg { namespace ndim{ /** \addtogroup space */ /*@{*/ /** The templated class for representing a point in R^N space. The class is templated over the ScalarType class that is used to represent coordinates. PointBase provides the interface and the common operators for points of any dimensionality. */ template class Point : public Eigen::Matrix { //---------------------------------------- // template typedef part // use it as follow: typename Point::Type instead of simply Point //---------------------------------------- public: typedef Eigen::Matrix Type; //---------------------------------------- // inheritence part //---------------------------------------- private: typedef Eigen::Matrix _Base; public: using _Base::coeff; using _Base::coeffRef; using _Base::setZero; using _Base::data; using _Base::V; _EIGEN_GENERIC_PUBLIC_INTERFACE(Point,_Base); VCG_EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Point) inline Point() : Base() {} template inline Point(const Eigen::MatrixBase& other) : Base(other) {} /// slower version, more stable (double precision only) inline S StableDot (const Point& p) const; /// Signed area operator /// a % b returns the signed area of the parallelogram inside a and b // inline S operator % ( PointType const & p ) const; }; // end class definition typedef Eigen::Matrix Point2s; typedef Eigen::Matrix Point2i; typedef Eigen::Matrix Point2f; typedef Eigen::Matrix Point2d; typedef Eigen::Matrix Vector2s; typedef Eigen::Matrix Vector2i; typedef Eigen::Matrix Vector2f; typedef Eigen::Matrix Vector2d; typedef Eigen::Matrix Point3s; typedef Eigen::Matrix Point3i; typedef Eigen::Matrix Point3f; typedef Eigen::Matrix Point3d; typedef Eigen::Matrix Vector3s; typedef Eigen::Matrix Vector3i; typedef Eigen::Matrix Vector3f; typedef Eigen::Matrix Vector3d; typedef Eigen::Matrix Point4s; typedef Eigen::Matrix Point4i; typedef Eigen::Matrix Point4f; typedef Eigen::Matrix Point4d; typedef Eigen::Matrix Vector4s; typedef Eigen::Matrix Vector4i; typedef Eigen::Matrix Vector4f; typedef Eigen::Matrix Vector4d; /*@}*/ } // end namespace ndim } // end namespace vcg #endif #endif