Click here to Skip to main content
15,895,777 members
Articles / Programming Languages / C#

Universal Framework for Science and Engineering - Part 2: Regression

Rate me:
Please Sign up or sign in to vote.
4.77/5 (19 votes)
11 Jul 20067 min read 51.2K   5K   76  
An article on universal scalable engineering framework applications.
//---------------------------------------------------------------------------

#ifndef VertexH
#define VertexH


////////////////////////////////////////////////////////////////////////
//
// Class: Vertex;
//
// Description:
//      GL vertex
//

#include "MultiVertex.h"
#include "ID3DFace.h"

class Vertex
{
    friend class MultiVertex;

	public:

		Vertex(double* x				 // The array of points' coordinates
			);							 // Constructor


        Vertex(double s,				 // The area
			const VectorD & position,	 // The position
			const VectorD & norm		 // The normale vector
			);							 // Constructor
        

		Vertex(ID3DFace * Face		 // The face
			);							 // Constructor from face

		Vertex(const Vertex & v		// Vertex to copy
			);							// Copy constructor


		Vertex(const VectorD & x1,	// First vertex
			const VectorD & x2,			// Second vertex
			const VectorD & x3			// Third vertex
			);							// Constructor by three vetrtices


		virtual ~Vertex();			 // Destructor

		void Set(double * x				 // The array of coordinates
			);							 // Sets new values vetrices coordinates from array

		
		void LoadFromStream(std::istream& is  // The input stream
			);			      // Loads this obect from stream


        const VectorD& GetVertex(int i	// The number of point
			) const;					// Returns the i - th vertex

        void SetVisibilityPoint(const VectorD & point // The point for visibility calculation 
			);										  // Sets the point for visibility calculation

        bool isVisible(const VectorD & point	// The point for visibility calculation
			
			);									// Returns visibility from the point

		void Init();							//Initialization

		const VectorD & GetPosition();			// Gets position

		void SetValue(double Value				// The value
			);									// Sets a value

		void SetParent(MultiVertex * Parent		// The parent
			);									// Sets parent
		void SetColorV(const VectorD & v				// The color vector
			);											// Sets color
	
		void ResetColor();				 //	Resets initial color to associated face

		void Reset();					 // Resets surface current

		virtual void SetTransitionMatrix(const MatrixD & m	// Transition matrix
			);									// Sets transition matrix

		double GetSolidAngleIntegral() const;	// Gets solid angle integral

		int GetMaterialNumber();				// Gets material number

	protected:
        
       VectorD Position;                // The relative position
        VectorC norm;                    // The normale vector
        VectorD normD;					 // The real normale vector
        bool enabled;                    // Auxiliary field
        double S;                        // The area of vertex
		ID3DFace * face;				 // The 3D graphics face associated with this object
        int index;						 // The index of the vertex
        VectorD vertices[3];			 // Array of vertices
        MultiVertex * parent;			 // Parent object
        VectorD ownColor;				 // Own color of the vertex
		double sum;						 // Auxiliary variable
		VectorD relative[3];			 // relative vectors;
		double distanceIn[3];			 // Input distances
		double distanceOut[3];			 // Output distances
		double sourceDistance;			 // Distance to source


		Vertex();						 // Constructor


		void ZeroExt();					 // Resets current induced by external field
        
		void ZeroInt();					 // Resets current induced by internal field

        void Prepare();					 // Preparation
		
		void SetFace(ID3DFace * Face	 // The face
			);							 // Conscructs the vertex for 3D graphics face
		
		
		void Draw(double a				 // The intensity parameter
			);							 // Draws the intensity of the EM current on 3D face

		void DrawValue(double min,		// Minimal value 
			double max					// Maximal value
			);							// Draws color according value
		

		VectorD proj;					// Projection of wave vector

		int materialNumber;			// Number of material;

		int calculatorNubmer;			// Number of calculator;

		double area;					 // The area of the object

		const VectorD& Vertex::GetNorm() const; // The normale vector


	private:
		
		
		void AddSquare();				 // Adds square of current to calculate EM color
		
		void ResetSum();				 // Resets sum color

        VectorD SourcePoint;             // The point of radiation source

        MatrixD VisibleMat;              // The auxiliary matrix for
		                                 // visibility calculation

        double VisibleProjection;        // Projection to normale
		
		double value;					// The color value

		double size;					// The size

		std::vector<Vertex *> barycentric();	//Barycentric division

		void CreateCollection(double Size, std::vector<Vertex *> & collection, std::vector<Vertex *> & del);

		static bool Colored;					// The "Colored" sign

};

std::istream& operator>>(std::istream& is, Vertex & v);


#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect
Russian Federation Russian Federation
Ph. D. Petr Ivankov worked as scientific researcher at Russian Mission Control Centre since 1978 up to 2000. Now he is engaged by Aviation training simulators http://dinamika-avia.com/ . His additional interests are:

1) Noncommutative geometry

http://front.math.ucdavis.edu/author/P.Ivankov

2) Literary work (Russian only)

http://zhurnal.lib.ru/editors/3/3d_m/

3) Scientific articles
http://arxiv.org/find/all/1/au:+Ivankov_Petr/0/1/0/all/0/1

Comments and Discussions