public static Position Clone(Position pos) { return new Position(pos.X, pos.Y, pos.Z); }
/// <summary> /// Check if the position is in range /// </summary> /// <param name="posTo"></param> /// <param name="range"></param> /// <returns></returns> public Boolean IsInRange(Position posTo, int range) { return DistanceTo(posTo) <= range; }
/// <summary> /// Returns the distance from this position and an other position /// </summary> /// <param name="posTo">Point dont on veux estimer la distance depuis la position actuelle</param> /// <returns></returns> public Double DistanceTo(Position posTo) { return Math.Abs(Math.Sqrt(Math.Pow(this.X - posTo.X, 2) + Math.Pow(this.Y - posTo.Y, 2) + Math.Pow(this.Z - posTo.Z, 2))); }
/// <summary> /// Check if this position is the circle /// </summary> /// <param name="other"></param> /// <param name="radius"></param> /// <returns></returns> public Boolean IsInCircle(Position other, Single radius) { Single _distX = this.X - other.X; Single _distZ = this.Z - other.Z; return (_distX * _distX + _distZ * _distZ) <= radius * radius; }
/// <summary> /// Copy the current object to another /// </summary> /// <param name="position"></param> public void Copy(ref Position position) { if (position == null) { position = new Position(); } position.X = this.X; position.Y = this.Y; position.Z = this.Z; //position. = this.Angle; //position.YAngle = this.YAngle; }