Skip to content

Instantly share code, notes, and snippets.

@chuongmep
Last active May 13, 2021 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuongmep/119f1e7004b7049937914c7750a4298a to your computer and use it in GitHub Desktop.
Save chuongmep/119f1e7004b7049937914c7750a4298a to your computer and use it in GitHub Desktop.
/// <summary>
/// Return DotProduct of two Vector
/// </summary>
/// <param name="vector"></param>
/// <param name="other"></param>
/// <returns></returns>
public static double Dot(Autodesk.DesignScript.Geometry.Vector vector,
Autodesk.DesignScript.Geometry.Vector other)
{
return vector.X * other.X + vector.Y * other.Y + vector.Z * other.Z;
}
/// <summary>
/// Obtains the dot product of two vectors.
/// </summary>
/// <param name="u">Vector3.</param>
/// <param name="v">Vector3.</param>
/// <returns>The dot product.</returns>
public static double DotProduct(this XYZ u, XYZ v)
{
return u.X * v.X + u.Y * v.Y + u.Z * v.Z;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment