Click here to Skip to main content
Click here to Skip to main content
Articles » Multimedia » OpenGL » General » Downloads
 
Add your own
alternative version

Basic Curves And Surfaces Modeler

, 18 Apr 2012
A basic demo of modeling curves and surfaces in OpenGL.
cadsurfexe.zip
CadSurfexe
CadSurf.exe
VKGeom.dll
VKGraphic.dll
cadsurf_demo.zip
cadsurf_src.zip
CadSurf_src
VKernel
VKGraphic
VKGraphic.dsp
VKGraphic.dsw
VKGraphic.plg
VKGeom
VKGeom.dsp
VKGeom.dsw
cadsurf
CadSurf.clw
CadSurf.dsp
cadsurf.dsw
Thumbs.db
res
bmp00001.bmp
cadsurf.ico
CADSURFDOC.ICO
new_splash.bmp
new_splash.PNG
new_splash_small.bmp
tb_geom.bmp
Thumbs.db
toolbar.bmp
toolbar1.bmp
untitled.bmp
XPStyle.manifest
CadSurf_VS2008.zip
CadSurf
cadsurf
CadSurf.suo
res
bmp00001.bmp
cadsurf.ico
CADSURFDOC.ICO
new_splash.bmp
new_splash.PNG
new_splash_small.bmp
tb_geom.bmp
Thumbs.db
toolbar.bmp
toolbar1.bmp
untitled.bmp
VKernel
VKGeom
VKGraphic
VKGraphic.plg
/*
 *  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 for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
/***************************************************************************
 *            Vector2D.h
 *
 *  Thu Jun 29 22:44:35 2006
 *  Copyright  2006  N. Sharjith
 *  sharjith@gmail.com
 ****************************************************************************/


#ifndef _VECTOR2D_H
#define _VECTOR2D_H

#include "VKGeom.h"

#include "Geometry2D.h"

class CPoint2D;
class CMatrix22;
class COneAxis2D;

class VKGEOM_API CVector2D : public CGeometry2D  
{
public:
	CVector2D();
	CVector2D(double x, double y);
	CVector2D(const CPoint2D&);
	CVector2D(const CVector2D&, const CVector2D&);
	CVector2D(const CPoint2D&, const CPoint2D&);
	~CVector2D();
	inline void SetX(double x){itsX = x;} //Set The X Component Value
	inline void SetY(double y){itsY = y;} //Set The Y Component Value
	inline void SetParam(double x, double y){itsX = x; itsY = y;} //Set The X Y and Z Values
	inline double GetX() const {return itsX;}// Returns The X Component
	inline double GetY() const {return itsY;}// Returns The Y Component
	double Dot(const CVector2D &V1) const;//Calculate Dot Product
	double DotCross(const CVector2D &V1, const CVector2D &V2);//Calculate Scalar Triple Product
	void Cross(const CVector2D &V1);//Calculate Cross Product Of' this' And Other
	CVector2D Crossed(const CVector2D &V1) const;//Return The Cross Product Vector
	void CrossCross(const CVector2D &V1, const CVector2D &V2);//Calculate The Vector Triple Product
	CVector2D CrossCrossed(const CVector2D &V1, const CVector2D &V2);//Return Vector Triple Product
	void Reverse();//Reverse The Direction Of 'this'
	CVector2D Reversed();//Return The Reversed Vector Of 'this'
	CVector2D operator + (const CVector2D &V1);//Return Addition Of 'this' And Other
	void operator += (const CVector2D &V1);//Add Other To 'this'
	CVector2D operator - (const CVector2D &V1);//Return Subtraction Of 'this' And Other
	void operator -= (const CVector2D &V1);//Subtract Other From 'this'
	CVector2D operator * (const double &scalar);//Scalar Multiple With Other Vector
	CVector2D operator * (const CMatrix22& M);//Multiply With Matrix
	void operator *= (const double &scalar);//Multiply 'this' With Other
	void operator *= (const CMatrix22 &M);//Multiply 'this With Matrix
	CVector2D operator / (const double &scalar);//Scalar Division
	void operator /= (const double &scalar);//Divide 'this' By Scalar
	CVector2D operator ^ (const CVector2D &V1);//Return The Cross Product
	void operator ^= (const CVector2D &V1);//Calculate Cross Product Of' this' And Other
	double Magnitude() const;// Calculate 'this' Vector's Magnitude
	double SqrMagnitude() const;// Calculate 'this' Vector's Square Magnitude
	double CrossMagnitude(const CVector2D &V);// Calculate 'this' Vector's Cross Magnitude
	double CrossSqrMagnitude(const CVector2D &V1);// Calculate 'this' Vector's Cross Square Magnitude
	double Modulus();// Return Modulus
	CVector2D Unit();//Return Normalized Vector Of 'this'
	CPoint2D Point();//Return Component Triplet As Point
	double Angle(const CVector2D&) const;//Angle Bet'n 'this' And Other
	double Angle(const CVector2D&, const CVector2D&) const;//Angle Bet'n 'this' And Other WRT Direction
	bool IsNull() const;//Check For Null Vector
	bool IsParallel(const CVector2D&) const;//Check If Parallel To Other
	bool IsOpposite(const CVector2D&) const;//Check If Opposite Direction To Other
	bool IsNormal(const CVector2D&) const;//Check If Normal To Other
	bool operator == (const CVector2D& V) const;//Check Equality
	operator CPoint2D();//Convertion Cast To Point;
	void Print() const;//Print Values Of Components
	void Normalize();//Normalize 'this' Vector
	virtual void Translate(const COneAxis2D&, const double&);
	virtual void Translate(double dx, double dy);
	virtual void Translate(const CVector2D&);
	virtual void Translate(const CPoint2D&, const CPoint2D&);
	virtual void Rotate(const CPoint2D&, double);
	virtual void Scale(const CPoint2D&, double);
	virtual void Mirror(const CPoint2D&);
	virtual void Mirror(const COneAxis2D&);
	static CVector2D Origin();
private:
	double itsX;
	double itsY;
};

#endif /* _VECTOR2D_H */

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sharjith
Engineer Tata Technologies Ltd
India India
Sharjith is a Mechanical Engineer with strong passion for Automobiles, Aircrafts and Software development.

| Advertise | Privacy | Mobile
Web04 | 2.8.140826.1 | Last Updated 18 Apr 2012
Article Copyright 2003 by Sharjith
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid