size.cpp
#include "size.h"
using namespace Robotics;
using namespace System;
using namespace System::Diagnostics;
Size::Size( double x, double y, double z )
{
this->X = x;
this->Y = y;
this->Z = z;
}
Size::Size( System::Xml::XmlElement^ element )
{
Xml::XmlElement^ node = element[ "size" ];
Debug::Assert( node != nullptr, "要素を有している" );
this->X = Double::Parse( node->GetAttribute( "x" ) );
this->Y = Double::Parse( node->GetAttribute( "y" ) );
this->Z = Double::Parse( node->GetAttribute( "z" ) );
}
Size Size::operator*=( double val )
{
m_x *= val;
m_y *= val;
m_z *= val;
return *this;
}
Size Size::operator/=( double val )
{
Debug::Assert( Double::Epsilon <= Math::Abs( val ), "引数はゼロではない (ゼロ除算の防止)" );
m_x /= val;
m_y /= val;
m_z /= val;
return *this;
}
Size Size::operator*( Size% obj, double val )
{
Size result( obj );
result *= val;
return result;
}
Size Size::operator/( Size% obj, double val )
{
Size result( obj );
result /= val;
return result;
}
bool Size::operator==( Size% left, Size% right )
{
return left.Equals( right );
}
bool Size::operator!=( Size% left, Size% right )
{
return !left.Equals( right );
}
bool Size::Equals( Size% obj )
{
return ( m_x == obj.m_x ) && ( m_y == obj.m_y ) && ( m_z == obj.m_z );
}
bool Size::IsZero()
{
return ( m_x == 0.0 ) && ( m_y == 0.0 ) && ( m_z == 0.0 );
}
System::String^ Size::ToString()
{
return String::Format( "{0:0.000} {1:0.000} {2:0.000}", m_x, m_y, m_z );
}