public static void SetAxis(SpeckleVector xVector, SpeckleVector xyVector, SpecklePoint origin, int Index, out string gwaCommand, string name = "") { gwaCommand = ""; var gwaCommands = new List <string>(); var ls = new List <string>() { "SET", "AXIS.1", Index.ToString(), name ?? "", "CART", origin.Value[0].ToString(), origin.Value[1].ToString(), origin.Value[2].ToString(), xVector.Value[0].ToString(), xVector.Value[1].ToString(), xVector.Value[2].ToString(), xyVector.Value[0].ToString(), xyVector.Value[1].ToString(), xyVector.Value[2].ToString(), }; gwaCommand = (string.Join(Initialiser.AppResources.Proxy.GwaDelimiter.ToString(), ls)); }
public static void SetAxis(SpeckleVector xVector, SpeckleVector xyVector, SpecklePoint origin, out int index, out string gwaCommand, string name = "") { gwaCommand = ""; index = Initialiser.Cache.ResolveIndex("AXIS.1"); var gwaCommands = new List <string>(); var ls = new List <string>() { "SET", "AXIS.1", index.ToString(), name ?? "", "CART", origin.Value[0].ToString(), origin.Value[1].ToString(), origin.Value[2].ToString(), xVector.Value[0].ToString(), xVector.Value[1].ToString(), xVector.Value[2].ToString(), xyVector.Value[0].ToString(), xyVector.Value[1].ToString(), xyVector.Value[2].ToString(), }; gwaCommand = (string.Join("\t", ls)); }
private SpeckleVector CrossProduct(SpeckleVector v1, SpeckleVector v2) { double x, y, z; x = v1.Value[1] * v2.Value[2] - v2.Value[1] * v1.Value[2]; y = (v1.Value[0] * v2.Value[2] - v2.Value[0] * v1.Value[2]) * -1; z = v1.Value[0] * v2.Value[1] - v2.Value[0] * v1.Value[1]; return(new SpeckleVector(x, y, z)); }
public static SpeckleVector ToSpeckle(this BHG.Vector bhomVector) { if (bhomVector == null) { return(default(SpeckleVector)); } SpeckleVector speckleVector = new SpeckleVector(bhomVector.X, bhomVector.Y, bhomVector.X); return(speckleVector); }
public void RotateAxisAboutZ(double angle) { if (angle == 0) { return; } var rotationMatrix = RotationMatrix(new Vector3D(Normal.Value[0], Normal.Value[1], Normal.Value[2]), angle); var X = Vector3D.Multiply(new Vector3D(Xdir.Value[0], Xdir.Value[1], Xdir.Value[2]), rotationMatrix); var Y = Vector3D.Multiply(new Vector3D(Ydir.Value[0], Ydir.Value[1], Ydir.Value[2]), rotationMatrix); Xdir = new SpeckleVector(X.X, X.Y, X.Z); Ydir = new SpeckleVector(Y.X, Y.Y, Y.Z); }
public void RotateAxisAboutZ(double angle) { if (angle == 0) { return; } var unitV = (new Vector3D(Normal.Value[0], Normal.Value[1], Normal.Value[2])).Normalize(); var rotationMatrix = RotationMatrix(unitV, angle); var X = (new Vector3D(Xdir.Value[0], Xdir.Value[1], Xdir.Value[2])).TransformBy(rotationMatrix); var Y = (new Vector3D(Ydir.Value[0], Ydir.Value[1], Ydir.Value[2])).TransformBy(rotationMatrix); Xdir = new SpeckleVector(X.X, X.Y, X.Z); Ydir = new SpeckleVector(Y.X, Y.Y, Y.Z); }
/// <summary> /// SpeckleVector to DS Vector /// </summary> /// <param name="vc"></param> /// <returns></returns> public static Vector ToNative(this SpeckleVector vc) { return(Vector.ByCoordinates(vc.Value[0], vc.Value[1], vc.Value[2])); }
public static Vector3d ToNative(this SpeckleVector pt) { return(new Vector3d(pt.Value[0], pt.Value[1], pt.Value[2])); }
public static Vector3 ToVector3(this SpeckleVector p) { return(new Vector3((float)p.Value[0], (float)p.Value[2], (float)p.Value[1])); }