/*
FEMSuite - (C) 2018 Fady Kamel
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 3 of the License, or
(at your option) any later version.
FEMSuite 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 FEMSuite. If not, see .
*/
#pragma once
#include "FEMSuiteCommondll.h"
#include "CommonTypes.h"
class PolarVector;
/// This class defines a spherical or polar vector
class _DLL CartesianVector : public Point
{
#pragma region Calculations
public:
/// Constructs the vector from two given points
void Construct( Point pF, const Point& p0 );
/// Calculates the target of this vector based on a center
/// Center point of this parameter
Point<> CalculateTarget( const Point<>& center );
#pragma endregion
#pragma region Conversions
public:
/// A unit vector corresponding to this vector
CartesianVector ToUnitVector() const;
/// A vector normal to this polar vector
CartesianVector ToNormal() const;
/// A Point corresponing to this vector in cartesian form.
PolarVector ToPolar() const;
#pragma endregion
#pragma region Geometric Calculations
public:
/// Calculates the dot product of this vector into another vector
Spatial Dot( const CartesianVector& other ) const;
/// Calculates the cross product (A x B), where this vector is vector A.
CartesianVector Cross( const CartesianVector& vectorB ) const;
#pragma endregion
#pragma region Ctor
public:
CartesianVector() {}
CartesianVector( const Spatial x, const Spatial y, const Spatial z ) : Point( x, y, z ) {}
CartesianVector( const Point<>& pF, const Point<>& p0 ) { Construct( pF, p0 ); }
CartesianVector( const DimensionArray& a ) : Point<>( a ) {}
#pragma endregion
};