public Line3(double x1In, double y1In, double z1In, double x2In, double y2In, double z2In) { Point1 = new Vector3(x1In, y1In, z1In); Point2 = new Vector3(x2In, y2In, z2In); Col = new System.Drawing.Color(); Init(); }
/// <summary> /// 离散Polygon /// </summary> /// <param name="polygon"></param> /// <param name="distance"></param> private IPolygon DiscretePolygon(IPolygon polygon, double distance) { string wkt = "PROJCS[\"<Custom Coordinate>\",GEOGCS[\"GCS_Beijing_1954\",DATUM[\"D_Beijing_1954\",SPHEROID[\"Krasovsky_1940\",6378245.0,298.3]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"false_easting\",64685.26],PARAMETER[\"false_northing\",-3267460.1405],PARAMETER[\"central_meridian\",120.0],PARAMETER[\"scale_factor\",1.0],PARAMETER[\"latitude_of_origin\",0.0],UNIT[\"Meter\",1.0]]"; ICoordinateReferenceSystem tempcrs = crsFactory.CreateFromWKT(wkt); IRing ring = polygon.ExteriorRing; IPolygon resPolygon = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; resPolygon.SpatialCRS = crs as ISpatialCRS; for (int i = 0; i < ring.PointCount - 1; i++) { IPoint point1 = ring.GetPoint(i); IPoint point2 = ring.GetPoint(i + 1); resPolygon.ExteriorRing.AppendPoint(point1); point1.Project(tempcrs as ISpatialCRS); point2.Project(tempcrs as ISpatialCRS); IVector3 p1 = point1.Position; IVector3 p2 = point2.Position; IEulerAngle angle = this.axRenderControl1.Camera.GetAimingAngles(p1, p2); p2.MultiplyByScalar(-1); double length = p1.Add(p2).Length; for (int j = 0; j < (int)(length / distance); j++) { IVector3 tempv3 = this.axRenderControl1.Camera.GetAimingPoint(p1, angle, (distance * (j + 1))); IPoint tempPoint = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); tempPoint.Position = tempv3; tempPoint.SpatialCRS = tempcrs as ISpatialCRS; tempPoint.Project(crs as ISpatialCRS); resPolygon.ExteriorRing.AppendPoint(tempPoint); } } resPolygon.Close(); return(resPolygon); }
public void Sub(IPoint3 p, IVector3 v) { ITuple3_Double _p = p.AsTupleDouble(); ITuple3_Double _v = v.AsTupleDouble(); this.Set(_p.X - _v.X, _p.Y - _v.Y, _p.Z - _v.Z); }
public Line3(ILine3 lineIn) { Point1 = new Vector3(lineIn.Point1); Point2 = new Vector3(lineIn.Point2); Col = lineIn.Col; Init(); }
public Line3(IVector3 Point1, IVector3 Point2) { this.Point1 = new Vector3(Point1); this.Point2 = new Vector3(Point2); Col = new System.Drawing.Color(); Init(); }
public void ProjectTo(IVector3 where) { BuffVector3d aux = new BuffVector3d(where); aux.ProjV(new Vector3d(this.x, this.y, this.z)); this.Set(aux.X, aux.Y, aux.Z); }
public void push(BlockShape s, IVector3 dir) { var moving = new List <Block>(); var mshapes = new List <BlockShape>() { s }; moving.AddRange(s.components); for (var i = 0; i < moving.Count(); i++) { var b = moving[i]; var tpos = b.pos + dir; var tb = this[tpos]; if (tb != null && !mshapes.Contains(tb.shape)) { moving.AddRange(tb.shape.components); mshapes.Add(tb.shape); } if (i > 1000) { throw new System.Exception("OH SNAP!!!"); } } foreach (var b in moving) { b.Move(this, dir); } }
public void Add(IPoint3 p, IVector3 v) { ITuple3_Double _p = p.AsTupleDouble(); ITuple3_Double _v = v.AsTupleDouble(); this.Set(_p.X + _v.X, _p.Y + _v.Y, _p.Z + _v.Z); }
/// <summary> /// Subtract a vector. /// </summary> /// <param name="a">Left hand vector</param> /// <param name="b">Vector to be subtracted</param> /// <param name="result">Vector that receives the result</param> /// <returns>Difference vector a-b</returns> public static IVector3 Sub(this IVector3 a, IVector3 b, ref IVector3 result) { result[0] = a[0] - b[0]; result[1] = a[1] - b[1]; result[2] = a[2] - b[2]; return(result); }
public void setPosition(IVector3 pos) { #if UNITY_EDITOR // if(isPlayerSide && isPlayer) // { // Log.log("== set pos : " + pos, this); // } #endif if (GameManager.me.recordMode == GameManager.RecordMode.continueGame) { setPositionCtransform(pos); return; } if (GameManager.loopIndex == 0) { prevTransformPosition = cTransformPosition; } //ff Log.log("== set pos : " + pos, this); cTransformPosition.x = pos.x; cTransformPosition.y = pos.y; cTransformPosition.z = pos.z; _needPositionRender = true; }
public override void Transform(IVector3 v, IOpVector3 vout) { ITuple3_Double _v = v.AsTupleDouble(); IOpTuple3_Double _vout = vout.AsOpTupleDouble(); _vout.Set(_v.X, _v.Y, _v.Z); }
public byte neighbors; // bitmask indicating which sides have neighbors public void AddNeighbor(ref SelectionTile other) { IVector3 delta = other.center - center; // Left-handed coordinate system means +x is to the left when +z points out of surface if (delta.x == -SIDE_CM && delta.y == 0) { neighbors |= (byte)Edge.Right; other.neighbors |= (byte)Edge.Left; } else if (delta.x == +SIDE_CM && delta.y == 0) { neighbors |= (byte)Edge.Left; other.neighbors |= (byte)Edge.Right; } else if (delta.x == 0 && delta.y == +SIDE_CM) { neighbors |= (byte)Edge.Top; other.neighbors |= (byte)Edge.Bottom; } else if (delta.x == 0 && delta.y == -SIDE_CM) { neighbors |= (byte)Edge.Bottom; other.neighbors |= (byte)Edge.Top; } }
public void SetEldest(int X, int Y, int Z, IVector3 eld) { if (isOnGrid(X, Y, Z)) { _grid [X, Y, Z].Eldest = eld; } }
public Block(IVector3 pos) { this.pos = pos; indest = true; no_weld = new List <IVector3>(); shape = new BlockShape(this); }
public bool checkingDefaultAttackRange(Monster attacker, Monster target, IVector3 targetPosition, float offset = 0.0f) { if (attacker.isPlayerSide == false) { if (isShortType) { return(VectorUtil.DistanceXZ(targetPosition, attacker.cTransformPosition) <= (IFloat)(attacker.stat.atkRange + target.damageRange + offset + attacker.damageRange)); // hitrange } else { return(Xfloat.lessEqualThan(attacker.cTransformPosition.x - attacker.stat.atkRange - offset - attacker.damageRange, targetPosition.x + target.hitObject.lineRight)); } } else { if (isShortType) { return(Xfloat.lessEqualThan(VectorUtil.DistanceXZ(targetPosition, attacker.cTransformPosition), attacker.stat.atkRange + target.damageRange + offset + attacker.damageRange)); // hitrange } else { return(Xfloat.greatEqualThan(attacker.cTransformPosition.x + attacker.stat.atkRange + offset + attacker.damageRange, target.hitObject.lineLeft + targetPosition.x)); } } }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="sourcePosition">The source position.</param> /// <param name="sourceStackPosition">The source stack position.</param> /// <param name="targetPosition">The target position.</param> public static void Add(NetworkMessage message, IVector3 sourcePosition, byte sourceStackPosition, IVector3 targetPosition) { message.AddPacketType(GamePacketType.CreatureMove); message.AddVector3(sourcePosition); message.AddByte(sourceStackPosition); message.AddVector3(targetPosition); }
/// <summary> /// Return the result of scalar multiplication (i.e. scale a vector) /// </summary> /// <param name="v">Vector to be scaled</param> /// <param name="s">Scaling factor</param> /// <param name="result">Vector that receives the result</param> /// <returns>Scaled vector a * s</returns> public static IVector3 Mul(this IVector3 v, float s, ref IVector3 result) { result[0] = v[0] * s; result[1] = v[1] * s; result[2] = v[2] * s; return(result); }
/// <summary> /// Returns the Cross Product of two Vectors /// </summary> /// <param name="vLeft"> /// Vector 1 /// </param> /// <param name="vRight"> /// Vector 2 /// </param> /// <returns> /// </returns> public static Vector3 Cross(IVector3 vLeft, IVector3 vRight) { return(new Vector3( vLeft.y * vRight.z - vLeft.z * vRight.y, vLeft.z * vRight.x - vLeft.x * vRight.z, vLeft.x * vRight.y - vLeft.y * vRight.x)); }
public ILine3 Translate(IVector3 translation) { ILine3 lineOut = new Line3(Point1.Plus(translation), Point2.Plus(translation)); lineOut.Col = Col; return(lineOut); }
public void Add_Force(IVector3 pos, Force f) { if (in_world(pos)) { Add_Force(this[pos], f); } }
/// <summary> /// Return the covariance matrix of an image /// </summary> /// <param name="tensor">Image tensor (normalised RGB, NHWC format)</param> /// <param name="mean">Mean image colour</param> /// <returns>Covariance matrix of the image</returns> public static Matrix3 Covariance(Tensor <float> tensor, IVector3 mean) { var granularity = tensor.Dimensions[3]; var total = (int)tensor.Length; var cov = Aggregate(total, granularity, Matrix3.Zero, Sum, Merge); return(cov._ / (tensor.Width() * tensor.Height())); Matrix3 Sum(int start, int end) { var agg = Matrix3.Zero; var tmp = Matrix3.Zero; var(m1, m2, m3) = mean; var data = ((DenseTensor <float>)tensor).Buffer.Span; for (int i = start; i < end; i += 3) { tmp.FromVector(data[i + 0] - m1, data[i + 1] - m2, data[i + 2] - m3); agg.Add(tmp, agg); } return(agg); } Matrix3 Merge(Matrix3 acc, Matrix3 cur) { return(acc.Add(cur, acc)); } }
public IBoundingBox BoundingBox() { var pts = new IVector3[] { Point1, Point2 }; IBoundingBox ext = BoundingBoxBuilder.FromPtArray(pts); return(ext); }
public PlyVertex() { ContainsColor = false; _containsNormal = false; _normal = new Vector3(); }
void scaleCalculate(IModelPoint oldMP, IModelPoint newMP, out double scaleX, out double scaleY, out double scaleZ, out double centerX, out double centerY, out double centerZ) { M0 = oldMP.AsMatrix(); M1 = newMP.AsMatrix(); IMatrix M0_Inverse = M0.Clone(); M0_Inverse.Inverse(); IMatrix MS = MultiplyMatrix(M0_Inverse, M1); IVector3 scaleV = MS.GetScale(); scaleX = scaleV.X; scaleY = scaleV.Y; scaleZ = scaleV.Z; centerX = MS.M41 / (1.0 - scaleV.X); centerY = MS.M42 / (1.0 - scaleV.Y); centerZ = MS.M43 / (1.0 - scaleV.Z); if (scaleV.X == 1) { centerX = MS.M41; } if (scaleV.Y == 1) { centerY = MS.M42; } if (scaleV.Z == 1) { centerZ = MS.M43; } }
private IModelPoint Polygon2ModelPoint(IPolygon polygon, out Gvitech.CityMaker.Resource.IModel gvModel) { if (polygon == null || !polygon.IsValid) { gvModel = null; return(null); } IVector3 vector = polygon.QueryNormal(); if (vector.Z < 0.0) { polygon.ExteriorRing.ReverseOrientation(); } IModelPoint result = null; IGeometryConvertor geometryConvertor = new GeometryConvertorClass(); ITriMesh triMesh = geometryConvertor.PolygonToTriMesh(polygon); if (triMesh != null) { IMultiTriMesh multiTriMesh = ((IGeometryFactory) new GeometryFactoryClass()).CreateGeometry(gviGeometryType.gviGeometryMultiTrimesh, polygon.VertexAttribute) as IMultiTriMesh; multiTriMesh.AddTriMesh(triMesh); bool flag = geometryConvertor.TriMeshToModelPoint(multiTriMesh, out gvModel, out result); if (flag && gvModel != null) { this.Model2Water(ref gvModel); } } else { result = null; gvModel = null; } return(result); }
/// <summary> /// Gets the spectators. /// </summary> /// <param name="position">The position.</param> /// <param name="range">The range.</param> /// <returns>The spectators.</returns> public IEnumerable <ICharacterSpawn> GetSpectators(IVector3 position, IVector3 range) { int startX = position.X - range.X; int endX = position.X + range.X; int startY = position.Y - range.Y; int endY = position.Y + range.Y; int startZ = position.Z - range.Z; int endZ = position.Z + range.Z; for (int nx = startX; nx < endX; nx++) { for (int ny = startY; ny < endY; ny++) { for (int nz = startZ; nz < endZ; nz++) { IVector3 spectatorPosition = new Vector3(nx, ny, nz); if (!_characterSpawnsByPosition.ContainsKey(spectatorPosition)) { continue; } foreach (ICharacterSpawn spectator in _characterSpawnsByPosition[spectatorPosition]) { yield return(spectator); } } } } }
public void SimpleMul(IVector3 v1, IVector3 v2) { ITuple3_Double _v1 = v1.AsTupleDouble(); ITuple3_Double _v2 = v2.AsTupleDouble(); this.Set(_v1.X * _v2.X, _v1.Y * _v2.Y, _v1.Z * _v2.Z); }
public void Sub(IVector3 v1, IVector3 v2) { ITuple3_Double _v1 = v1.AsTupleDouble(); ITuple3_Double _v2 = v2.AsTupleDouble(); this.Set(_v1.X - _v2.X, _v1.Y - _v2.Y, _v1.Z - _v2.Z); }
public void Add(IVector3 v1, IVector3 v2) { ITuple3_Double _v1 = v1.AsTupleDouble(); ITuple3_Double _v2 = v2.AsTupleDouble(); this.Set(_v1.X + _v2.X, _v1.Y + _v2.Y, _v1.Z + _v2.Z); }
public double TripleProduct(IVector3 v2, IVector3 v3) { BuffVector3d aux = new BuffVector3d(v2); aux.Cross(v3); return(this.Dot(aux)); }
/// <summary> /// Initializes a new instance of the <see cref="CompassValue"/> class. /// </summary> /// <param name="timestamp">The timestamp.</param> /// <param name="headingAccuracy">The heading accuracy.</param> /// <param name="magneticHeading">The magnetic heading.</param> /// <param name="magnetometerReading">The magnetometer reading.</param> /// <param name="trueHeading">The true heading.</param> public CompassValue(DateTimeOffset timestamp, double headingAccuracy, double magneticHeading, IVector3 magnetometerReading, double trueHeading) { Timestamp = timestamp; HeadingAccuracy = headingAccuracy; MagneticHeading = magneticHeading; MagnetometerReading = magnetometerReading; TrueHeading = trueHeading; }
/// <summary> /// Moves the specified entity towards the passed destination. /// </summary> /// <param name="entityName">Name of the entity to move.</param> /// <param name="destination">Destination to move towards.</param> public void MoveTowards(string entityName, IVector3 destination) { IMortarEntity entity = EntityManager.GetEntity(entityName); MovementComponent component = entity.GetComponent<MovementComponent>(); component.Destination = destination; if(component.DistanceToDestination > component.DestinationReachedDistance) { component.IsMovingTowardsEntity = false; component.IsMoving = true; // ToDo: Set SystemVariable MovingEntity //SystemVariables.MovingEntity = name; StartedMoving incident = new StartedMoving(); incident.EntityName = entityName; incident.Destination = destination; QueueEvent(incident); } }
/// <summary> /// Returns the Cross Product of two Vectors /// </summary> /// <param name="vRight"> /// Other Vector /// </param> /// <returns> /// </returns> public Vector3 Cross(IVector3 vRight) { return Cross(this, vRight); }
/// <summary> /// Returns the Cross Product of two Vectors /// </summary> /// <param name="vLeft"> /// Vector 1 /// </param> /// <param name="vRight"> /// Vector 2 /// </param> /// <returns> /// </returns> public static Vector3 Cross(IVector3 vLeft, IVector3 vRight) { return new Vector3( vLeft.y * vRight.z - vLeft.z * vRight.y, vLeft.z * vRight.x - vLeft.x * vRight.z, vLeft.x * vRight.y - vLeft.y * vRight.x); }
/// <summary> /// Returns the Dot Product of two Vectors /// </summary> /// <param name="v1"> /// Vector 1 /// </param> /// <param name="v2"> /// Vector 2 /// </param> /// <returns> /// </returns> public static double Dot(IVector3 v1, IVector3 v2) { return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; }
/// <summary> /// Returns the Dot Product of two Vectors /// </summary> /// <param name="v1"> /// Other Vector /// </param> /// <returns> /// </returns> public double Dot(IVector3 v1) { return Dot(this, v1); }
/// <summary> /// Sets the position of an entity. /// </summary> /// <param name="entityName">Name of the entity to set the position for.</param> /// <param name="targetPosition">Position to set.</param> public void SetPosition(string entityName, IVector3 targetPosition) { IMortarEntity entity = EntityManager.GetEntity(entityName); MovementComponent component = entity.GetComponent<MovementComponent>(); component.Position = targetPosition; // ToDo: Set SystemVariable CurrentScene //SystemVariables.PositionedEntity = name; EntityChangedPosition incident = new EntityChangedPosition(); incident.EntityName = entityName; QueueEvent(incident); }
/// <summary> /// Returns the angle in degrees between a and b. /// </summary> /// <param name="a">Vector a.</param> /// <param name="b">Vector b.</param> /// <returns> /// Angle between a and b in degrees. /// The angle returned is always the acute angle between the two vector /// (ie, the smaller of the two possible angles between them and never greater than 180 degrees).</returns> public static float AngleBetween(IVector3 a, IVector3 b) { return Vector3.Angle(ToUnity(a), ToUnity(b)); }
/// <summary> /// Converts a <see cref="IVector3"/> to a <see cref="UnityEngine.Vector3"/>. /// </summary> /// <param name="vector"><see cref="IVector3"/> to convert.</param> private static Vector3 ToUnity(IVector3 vector) { return new Vector3(vector.X, vector.Y, vector.Z); }
/// <summary> /// Moves a point current in a straight line towards a target point. /// </summary> /// <param name="current">The current point.</param> /// <param name="target">The target point.</param> /// <param name="distance">Distance to move.</param> /// <returns> /// The value returned by this function is a point maxDistanceDelta units closer to a target/ point along a line between current and target. /// If the target is closer than maxDistanceDelta/ then the returned value will be equal to target (ie, the movement will not overshoot the target). /// Negative values of maxDistanceDelta can be used to push the point away from the target. /// </returns> public static IVector3 MoveTowards(IVector3 current, IVector3 target, float distance) { return new UnityVector3(Vector3.MoveTowards(ToUnity(current), ToUnity(target), distance)); }
/// <summary> /// Rotates an entity towards a certain direction. /// </summary> /// <param name="entityName">Name of the entity to rotate.</param> /// <param name="targetDirection">Direction to rotate towards.</param> public void RotateTowards(string entityName, IVector3 targetDirection) { IMortarEntity entity = EntityManager.GetEntity(entityName); MovementComponent component = entity.GetComponent<MovementComponent>(); component.TargetDirection = targetDirection; if(component.DistanceToDirection > component.RotationFinishedDistance) { component.IsRotateing = true; // ToDo: Set SystemVariable CurrentScene //SystemVariables.RotatingEntity = name; StartedRotatingTowardsDirection incident = new StartedRotatingTowardsDirection(); incident.EntityName = entityName; incident.Target = targetDirection; QueueEvent(incident); } }
/// <summary> /// Fill this info in /// </summary> /// <param name="vDirection"> /// </param> /// <returns> /// Fill this info in /// </returns> public static IQuaternion GenerateRotationFromDirectionVector(IVector3 vDirection) { // Step 1. Setup basis vectors describing the rotation given the input vector and assuming an initial up direction of (0, 1, 0) Vector3 vDirNormalized = Vector3.Normalize((Vector3)vDirection); Vector3 vUp = new Vector3(0, 1.0f, 0.0f); // Y Up vector Vector3 vRight = Vector3.Cross(vUp, vDirNormalized); // The perpendicular vector to Up and Direction vUp = Vector3.Cross(vDirNormalized, vRight); // The actual up vector given the direction and the right vector // Step 2. Put the three vectors into the matrix to bulid a basis rotation matrix // This step isnt necessary, but im adding it because often you would want to convert from matricies to quaternions instead of vectors to quaternions // If you want to skip this step, you can use the vector values directly in the quaternion setup below Matrix mBasis = new DenseMatrix(4, 4); mBasis.SetRow(0, new[] { (float)vRight.x, (float)vRight.y, (float)vRight.z, 0.0f }); mBasis.SetRow(1, new[] { (float)vUp.x, (float)vUp.y, (float)vUp.z, 0.0f }); mBasis.SetRow(2, new[] { (float)vDirNormalized.x, (float)vDirNormalized.y, (float)vDirNormalized.z, 0.0f }); mBasis.SetRow(3, new[] { 0.0f, 0.0f, 0.0f, 1.0f }); // Step 3. Build a quaternion from the matrix double dfWScale = Math.Sqrt(1.0f + mBasis.At(0, 0) + mBasis.At(1, 1) + mBasis.At(2, 2)) / 2.0f * 4.0; if (dfWScale == 0.0) { Quaternion q = new Quaternion(0, 1, 0, 0); return q; } Quaternion qrot = new Quaternion( (float)((mBasis.At(3, 2) - mBasis.At(2, 3)) / dfWScale), (float)((mBasis.At(0, 2) - mBasis.At(2, 0)) / dfWScale), (float)((mBasis.At(1, 0) - mBasis.At(0, 1)) / dfWScale), (float)Math.Sqrt(1.0f + mBasis.At(0, 0) + mBasis.At(1, 1) + mBasis.At(2, 2)) / 2.0f); var temp = qrot.w; qrot.w = qrot.y; qrot.y = temp; return qrot.Normalize(); }
/// <summary> /// Sets the rotation of an entity. /// </summary> /// <param name="entityName">Name of the entity to set the rotation for.</param> /// <param name="targetDirection">Direction to set.</param> public void SetRotation(string entityName, IVector3 targetDirection) { IMortarEntity entity = EntityManager.GetEntity(entityName); MovementComponent component = entity.GetComponent<MovementComponent>(); component.Rotation.EulerAngles = targetDirection; // ToDo: Set SystemVariable RotatedEntity //SystemVariables.RotatedEntity = name; EntityChangedRotation incident = new EntityChangedRotation(); incident.EntityName = entityName; QueueEvent(incident); }
/// <summary> /// Creates a Unity implementation for <see cref="IVector3"/>. /// </summary> /// <param name="x">X-coordinate of the vector.</param> /// <param name="y">Y-coordinate of the vector.</param> /// <param name="z">Z-coordinate of the vector.</param> public UnityVector3(IVector3 vector3) : this(vector3.X, vector3.Y, vector3.Z) { }
/// <summary> /// Create a Quaternion representation from a Vector3 (w is 0) /// </summary> /// <param name="v"> /// Vector of Rotation /// </param> public Quaternion(IVector3 v) { this.x = v.x; this.y = v.y; this.z = v.z; this.w = 0; }
IQuaternion IQuaternion.GenerateRotationFromDirectionVector(IVector3 vDirection) { return GenerateRotationFromDirectionVector(vDirection); }
/// <summary> /// Return a Vector rotated around the Quaternion /// </summary> /// <param name="q1"> /// Quaternion /// </param> /// <param name="v2"> /// Vector /// </param> /// <returns> /// </returns> public static IVector3 RotateVector3(IQuaternion q1, IVector3 v2) { Quaternion QuatVect = new Quaternion(v2.x, v2.y, v2.z, 0); Quaternion QuatNorm = (Quaternion)q1.Normalize(); Quaternion Result = Hamilton(Hamilton(QuatNorm, QuatVect), QuatNorm.Conjugate()); return new Vector3(Result.x, Result.y, Result.z); }
/// <summary> /// Calculates the distance between this vector and the passed vector. /// </summary> /// <param name="target">Target vector.</param> /// <returns>The distance between this vector and the passed vector.</returns> public float DistanceTo(IVector3 target) { return Vector3.Distance(unityVector3, ToUnity(target)); }
/// <summary> /// Return a Vector rotated around the Quaternion /// Note: Only works for Unit Quaternions at present due to lazyness (AO-provided Quaternions are all Unit Quaternions) /// </summary> /// <param name="v1"> /// Vector /// </param> /// <returns> /// </returns> public IVector3 RotateVector3(IVector3 v1) { return RotateVector3(this, v1); }
/// <summary> /// Creates a Unity implementation for <see cref="IQuaternion"/>. /// </summary> /// <param name="vector">Vector to create quaternion form.</param> public UnityQuaternion(IVector3 vector) : this(new Vector3(vector.X, vector.Y, vector.Z)) { }
public void RotateTowards(IVector3 target) { throw new NotImplementedException(); }
/// <summary> /// Calculates the distance between two vectors. /// </summary> /// <param name="a">Vector a.</param> /// <param name="b">Vector b.</param> /// <returns>The distance between the two passed vectors.</returns> public static float Distance(IVector3 a, IVector3 b) { return Vector3.Distance(ToUnity(a), ToUnity(b)); }
public void MoveTowards(IVector3 target) { }
/// <summary> /// Sets or updates the destionation of the agent, thus triggers the calculation of a new path. /// </summary> /// <param name="destination">Destination to set.</param> public void SetDestination(IVector3 destination) { Destination = destination; }