Esempio n. 1
0
 private static Vector3 GetAnchorGuess(Entity connectionA, Entity connectionB)
 {
     var anchor = new Vector3();
     if (connectionA != null)
         anchor.Add( ref connectionA.position, out anchor );
     if (connectionB != null)
         anchor.Add( ref connectionB.position, out anchor );
     if (connectionA != null && connectionB != null)
         anchor.Mult( 0.5f, out anchor );
     return anchor;
 }
Esempio n. 2
0
		private static void GetAnchorGuess( Entity connectionA, Entity connectionB, out Vector3 anchor )
		{
			if( connectionA != null && connectionB != null )
			{
				connectionA.position.Add( ref connectionA.position, out anchor );
				anchor.Mult( 0.5f, out anchor );
			}
			else if( connectionA != null )
				anchor = connectionA.position;
			else if( connectionB != null )
				anchor = connectionB.position;
			anchor = Vector3.Zero;
		}
Esempio n. 3
0
 public ArchitectTilePositionGetter(Vector3 position, LayerData selectedLayer)
 {
     layer = selectedLayer;
     if (selectedLayer == null)
     {
         Clear();
         Valid = false;
     }
     else
     {
         Vector3 TileP = position.Div(new Vector3(selectedLayer.TileWidth, selectedLayer.TileHeight, 1)).Round().SetValues(0, Axes.Z);
         tilePosition     = new Point2((int)TileP.x, (int)TileP.y);
         tileWorlPosition = TileP.Mult(new Vector3(selectedLayer.TileWidth, selectedLayer.TileHeight, 1));
         Valid            = layer.IsInLayerBound(tilePosition.X, tilePosition.Y);
     }
 }
Esempio n. 4
0
 public static Vector3 Mult(this Vector3 vector, Vector4 otherVector)
 {
     return(vector.Mult((Vector3)otherVector, Axis.XYZ));
 }
Esempio n. 5
0
 public static Vector3 Mult(this Vector3 vector, Vector2 otherVector, Axis axis)
 {
     return(vector.Mult((Vector3)otherVector, axis));
 }
Esempio n. 6
0
 public static Vector3 Mult(this Vector3 vector, Vector4 otherVector, string axis)
 {
     return(vector.Mult((Vector3)otherVector, axis));
 }
Esempio n. 7
0
 public static Vector3 Mult(this Vector3 vector, Vector2 otherVector)
 {
     return(vector.Mult((Vector3)otherVector, "XY"));
 }
Esempio n. 8
0
 public static Vector3 Mult(this Vector3 vector, Vector3 otherVector)
 {
     return(vector.Mult(otherVector, "XYZ"));
 }
Esempio n. 9
0
 public static Vector3 Mult(this Vector3 vector, Vector3 values)
 {
     return(vector.Mult(values, Axes.XYZW));
 }
Esempio n. 10
0
        public void OrthoNormalise(Vector3 u, Vector3 v, Vector3 w)
        {
            // If the input vectors are v0, v1, and v2, then the Gram-Schmidt
            // orthonormalization produces vectors u0, u1, and u2 as follows,
            //
            //   u0 = v0/|v0|
            //   u1 = (v1-(u0*v1)u0)/|v1-(u0*v1)u0|
            //   u2 = (v2-(u0*v2)u0-(u1*v2)u1)/|v2-(u0*v2)u0-(u1*v2)u1|
            //
            // where |A| indicates length of vector A and A*B indicates dot
            // product of vectors A and B.

            // compute u0
            u.Normalise();

            // compute u1
            double dot0 = u.Dot(v);
            v = v.Sub(u.Mult(dot0));
            v.Normalise();

            // compute u2
            double dot1 = v.Dot(w);
            dot0 = u.Dot(w);
            w = w.Sub(u.Mult(dot0).Add(v.Mult(dot1)));
            w.Normalise();
        }
Esempio n. 11
0
	public static Vector3 Mult(this Vector3 vector, Vector4 otherVector) {
		return vector.Mult((Vector3)otherVector, "XYZ");
	}