public override void setParentPositionWithoutMoving(Position a_parentPosition) { Position t_parent = a_parentPosition; while (t_parent != null) { if (t_parent == this) { throw new ArgumentException("This parenting will cause an inheirt paradox"); } else { t_parent = t_parent.getParentPosition(); } } if (a_parentPosition == null) { m_coordinates = getGlobalCartesianCoordinates(); } else { m_coordinates = getGlobalCartesianCoordinates() - a_parentPosition.getGlobalCartesianCoordinates(); } m_parentPosition = a_parentPosition; }
public float getDistanceTo(Position a_point) { return (a_point.getGlobalCartesianCoordinates()-getGlobalCartesianCoordinates()).Length(); }