36 #include "UblasIncludes.hpp" 37 #include "DimensionalChastePoint.hpp" 39 template<
unsigned DIM>
41 mReferenceLength(referenceLength),
46 EXCEPTION(
"Point has zero reference length");
63 template<
unsigned DIM>
70 EXCEPTION(
"Point has zero reference length");
73 for (
unsigned i=0; i<DIM; i++)
79 template<
unsigned DIM>
86 template<
unsigned DIM>
93 template<
unsigned DIM>
99 template<
unsigned DIM>
105 template<
unsigned DIM>
111 template<
unsigned DIM>
117 template<
unsigned DIM>
123 template<
unsigned DIM>
129 template<
unsigned DIM>
135 template<
unsigned DIM>
141 template<
unsigned DIM>
147 template<
unsigned DIM>
154 template<
unsigned DIM>
161 template<
unsigned DIM>
168 template<
unsigned DIM>
175 template<
unsigned DIM>
178 bool returned_value =
true;
180 for (
unsigned dim=0; dim<DIM; dim++)
182 if (comparison_loc[dim] !=
mLocation[dim])
184 returned_value =
false;
188 return returned_value;
191 template<
unsigned DIM>
194 if(lenthScale == 0.0*unit::metres)
196 EXCEPTION(
"Attempted to assign a zero length scale");
202 template<
unsigned DIM>
205 double sin_a = std::sin(angle);
206 double cos_a = std::cos(angle);
207 c_vector<double, 3> unit_axis = axis / norm_2(axis);
208 if(DIM==2 and unit_axis[2]!= 1.0)
210 EXCEPTION(
"2D rotation is about z axis only");
213 c_vector<double, DIM> old_location = this->
mLocation;
214 c_vector<double, DIM> new_location;
217 double dot_product = inner_prod(old_location, unit_axis);
218 new_location[0] = (unit_axis[0] * dot_product * (1.0 - cos_a) + old_location[0] * cos_a
219 + (-unit_axis[2] * old_location[1] + unit_axis[1] * old_location[2]) * sin_a);
220 new_location[1] = (unit_axis[1] * dot_product * (1.0 - cos_a) + old_location[1] * cos_a
221 + (unit_axis[2] * old_location[0] - unit_axis[0] * old_location[2]) * sin_a);
222 new_location[2] = (unit_axis[2] * dot_product * (1.0 - cos_a) + old_location[2] * cos_a
223 + (-unit_axis[1] * old_location[0] + unit_axis[0] * old_location[1]) * sin_a);
227 new_location[0] = old_location[0] * cos_a - old_location[1]*sin_a;
228 new_location[1] = old_location[0] * sin_a + old_location[1]*cos_a;
234 template<
unsigned DIM>
240 template<
unsigned DIM>
246 template<
unsigned DIM>
252 template<
unsigned DIM>
DimensionalChastePoint(double x=0.0, double y=0.0, double z=0.0, units::quantity< unit::length > referenceLength=1.e-6 *unit::metres)
c_vector< double, DIM > GetUnitTangent(const DimensionalChastePoint< DIM > &rLocation) const
DimensionalChastePoint< DIM > & operator-=(const DimensionalChastePoint< DIM > &rLocation)
bool IsCoincident(const DimensionalChastePoint< DIM > &rLocation) const
units::quantity< unit::length > GetReferenceLengthScale() const
DimensionalChastePoint< DIM > GetMidPoint(const DimensionalChastePoint< DIM > &rLocation) const
units::quantity< unit::length > GetDistance(const DimensionalChastePoint< DIM > &rLocation) const
DimensionalChastePoint< DIM > & operator*=(double factor)
void SetIndex(unsigned index)
void TranslateTo(DimensionalChastePoint< DIM > rPoint)
c_vector< double, DIM > GetUnitVector() const
c_vector< double, DIM > GetLocation(units::quantity< unit::length > scale)
units::quantity< unit::length > mReferenceLength
void RotateAboutAxis(c_vector< double, 3 > axis, double angle)
units::quantity< unit::length > GetNorm2()
void SetReferenceLengthScale(units::quantity< unit::length > lenthScale)
static boost::shared_ptr< DimensionalChastePoint< DIM > > Create(double x, double y, double z, units::quantity< unit::length > referenceLength)
virtual ~DimensionalChastePoint()
DimensionalChastePoint< DIM > & operator/=(double factor)
void Translate(DimensionalChastePoint< DIM > rVector)
c_vector< double, DIM > mLocation
DimensionalChastePoint< DIM > & operator+=(const DimensionalChastePoint< DIM > &rLocation)