<commit_before>// $Id: triangulatedSurface.h,v 1.12 2001/01/10 14:50:10 strobel Exp $

#ifndef BALL_STRUCTURE_TRIANGULATEDSURFACE_H
#define BALL_STRUCTURE_TRIANGULATEDSURFACE_H

#ifndef BALL_MATHS_VECTOR3_H
#	include <BALL/MATHS/vector3.h>
#endif

#ifndef BALL_MATHS_SURFACE_H
#	include <BALL/MATHS/surface.h>
#endif

#include <list>
#include <vector>
#include <fstream>

namespace BALL
{

	/** Generic TriangulatedSurface Class.
			\\
			{\bf Definition:}\URL{BALL/STRUCTURE/triangulatedSurface.h}
			\\
	*/
	template <class T>
	class TTriangulatedSurface
	{
		
		public:

		BALL_CREATE(TTriangulatedSurface)

		/**	@name	Type Definitions
		*/
		//@{

		/**
		*/
		class Point;
		class Edge;
		class Triangle
		{
			public:
			Triangle() :  point(3), edge(3)/*, triangle(3)*/, index(-1)
			{
			}
			~Triangle()
			{
			}
			Edge* other(Point* p)
			{
				for (Position i = 0; i < edge.size(); i++)
				{
					if ((edge[i]->point[0] != p) && (edge[i]->point[1] != p))
					{
						return edge[i];
					}
				}
				return NULL;
			}
			vector<Point*> point;
			vector<Edge*> edge;
//			vector<Triangle*> triangle;
			long int index;
		};
		
		class Edge
		{
			public:
			Edge() :  point(2), triangle(2), index(-1)
			{
			}
			~Edge()
			{
			}
			void del(Triangle* p)
			{
				for (Position i = 0; i < triangle.size(); i++)
					{
						if (triangle[i] == p)
							{
								triangle[i] = NULL;
							}
					}
			}
			bool operator == (const Edge& e)
				{
					return ( ((point[0]->p == e->point[0]->p) && (point[1]->p == e->point[1]->p)) ||
									 ((point[0]->p == e->point[1]->p) && (point[1]->p == e->point[0]->p))    );
				}
			vector<Point*> point;
			vector<Triangle*> triangle;
			long int index;
		};

		class Point
		{
			public:
			Point() :  p(), n(), edge(), triangle(), index(-1)
			{
			}
			~Point()
			{
			}
			TVector3<T> p;
			TVector3<T> n;
			std::list<Edge*> edge;
			std::list<Triangle*> triangle;
			Index state;
			long int index;
		};
		//@}

		/**	@name	Constructors and Destructors
		*/
		//@{

		/**	Default constructor.
				This method creates a new TriangulatedSurface object.
		*/
		TTriangulatedSurface()
			: points(), edges(), triangles()
		{
		}

		/**	Copy constructor.
				Create a new RSVertex object from another.
				@param triangulatedSurface the TriangulatedSurface object to be copied
				@param bool ignored - just for interface consistency
		*/
		TTriangulatedSurface(const TTriangulatedSurface<T>& /*surface*/, bool /* deep */ = true)
		{
/*			std::list<Point*>::iterator p;
			for (p = surface.points.begin(); p != surface.points.end(); p++)
			{
				Point* point = new Point(*(*p));
				points.push_back(point);
			}
			std::list<Edge*>::iterator e;
			for (e = surface.edges.begin(); e != surface.edges.end(); e++)
			{
				Edge* edge = new Edge(*(*e));
				edges.push_back(edge);
			}
			std::list<Triangle*>::iterator t;
			for (t = surface.triangles.begin(); t != surface.triangles.end(); t++)
			{
				Triangle* triangle = new Triangle(*(*t));
				triangles.push_back(triangle);
			}*/
		}

		/**	Destructor.
				Destructs the TriangulatedSurface object.
		*/
		virtual ~TTriangulatedSurface()
		{
			for (list<Point*>::iterator i = points.begin(); i != points.end(); i++)
			{
				delete *i;
			}
			for (list<Edge*>::iterator i = edges.begin(); i != edges.end(); i++)
			{
				delete *i;
			}
			for (list<Triangle*>::iterator i = triangles.begin(); i != triangles.end(); i++)
			{
				delete *i;
			}<commit_msg>fixed: use of iterators, where const iterators are needed<commit_after>// $Id: triangulatedSurface.h,v 1.13 2001/01/22 13:22:52 oliver Exp $

#ifndef BALL_STRUCTURE_TRIANGULATEDSURFACE_H
#define BALL_STRUCTURE_TRIANGULATEDSURFACE_H

#ifndef BALL_MATHS_VECTOR3_H
#	include <BALL/MATHS/vector3.h>
#endif

#ifndef BALL_MATHS_SURFACE_H
#	include <BALL/MATHS/surface.h>
#endif

#include <list>
#include <vector>
#include <fstream>

namespace BALL
{

	/** Generic TriangulatedSurface Class.
			\\
			{\bf Definition:}\URL{BALL/STRUCTURE/triangulatedSurface.h}
			\\
	*/
	template <class T>
	class TTriangulatedSurface
	{
		
		public:

		BALL_CREATE(TTriangulatedSurface)

		/**	@name	Type Definitions
		*/
		//@{

		/**
		*/
		class Point;
		class Edge;
		class Triangle
		{
			public:
			Triangle() :  point(3), edge(3)/*, triangle(3)*/, index(-1)
			{
			}
			~Triangle()
			{
			}
			Edge* other(Point* p)
			{
				for (Position i = 0; i < edge.size(); i++)
				{
					if ((edge[i]->point[0] != p) && (edge[i]->point[1] != p))
					{
						return edge[i];
					}
				}
				return NULL;
			}
			vector<Point*> point;
			vector<Edge*> edge;
//			vector<Triangle*> triangle;
			long int index;
		};
		
		class Edge
		{
			public:
			Edge() :  point(2), triangle(2), index(-1)
			{
			}
			~Edge()
			{
			}
			void del(Triangle* p)
			{
				for (Position i = 0; i < triangle.size(); i++)
					{
						if (triangle[i] == p)
							{
								triangle[i] = NULL;
							}
					}
			}
			bool operator == (const Edge& e)
				{
					return ( ((point[0]->p == e->point[0]->p) && (point[1]->p == e->point[1]->p)) ||
									 ((point[0]->p == e->point[1]->p) && (point[1]->p == e->point[0]->p))    );
				}
			vector<Point*> point;
			vector<Triangle*> triangle;
			long int index;
		};

		class Point
		{
			public:
			Point() :  p(), n(), edge(), triangle(), index(-1)
			{
			}
			~Point()
			{
			}
			TVector3<T> p;
			TVector3<T> n;
			std::list<Edge*> edge;
			std::list<Triangle*> triangle;
			Index state;
			long int index;
		};
		//@}

		/**	@name	Constructors and Destructors
		*/
		//@{

		/**	Default constructor.
				This method creates a new TriangulatedSurface object.
		*/
		TTriangulatedSurface()
			: points(), edges(), triangles()
		{
		}

		/**	Copy constructor.
				Create a new RSVertex object from another.
				@param triangulatedSurface the TriangulatedSurface object to be copied
				@param bool ignored - just for interface consistency
		*/
		TTriangulatedSurface(const TTriangulatedSurface<T>& surface, bool /* deep */ = true)
		{
			std::list<Point*>::const_iterator p;
			for (p = surface.points.begin(); p != surface.points.end(); p++)
			{
				Point* point = new Point(*(*p));
				points.push_back(point);
			}
			std::list<Edge*>::const_iterator e;
			for (e = surface.edges.begin(); e != surface.edges.end(); e++)
			{
				Edge* edge = new Edge(*(*e));
				edges.push_back(edge);
			}
			std::list<Triangle*>::const_iterator t;
			for (t = surface.triangles.begin(); t != surface.triangles.end(); t++)
			{
				Triangle* triangle = new Triangle(*(*t));
				triangles.push_back(triangle);
			}
		}

		/**	Destructor.
				Destructs the TriangulatedSurface object.
		*/
		virtual ~TTriangulatedSurface()
		{
			for (list<Point*>::iterator i = points.begin(); i != points.end(); i++)
			{
				delete *i;
			}
			for (list<Edge*>::iterator i = edges.begin(); i != edges.end(); i++)
			{
				delete *i;
			}
			for (list<Triangle*>::iterator i = triangles.begin(); i != triangles.end(); i++)
			{
				delete *i;
			}
{'fraction_non_alphanumeric': 0.18028811867066039, 'fraction_numerical': 0.011695906432748537, 'mean_word_length': 2.700263852242744, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4032576', 'n_tokens_mistral': 3229, 'n_tokens_neox': 2564, 'n_words': 554}