Added Summeries

This commit is contained in:
Michel Fedde 2021-03-19 20:59:02 +01:00
parent 71a22df8bd
commit 8296d9b8a9
47 changed files with 812 additions and 177 deletions

View file

@ -49,21 +49,59 @@ namespace SM.OGL.Mesh
/// <returns></returns>
public Vector3 this[bool x, bool y, bool z] => Get(x,y,z);
/// <summary>
/// Equivalent to <see cref="this"/>.
/// <para>Returns specific configurations of corners</para>
/// </summary>
/// <param name="x">If true, it takes the X-value of maximum, otherwise the minimum.</param>
/// <param name="y">If true, it takes the Y-value of maximum, otherwise the minimum.</param>
/// <param name="z">If true, it takes the Z-value of maximum, otherwise the minimum.</param>
/// <returns></returns>
public Vector3 Get(bool x, bool y, bool z)
{
return new Vector3(x ? Max.X : Min.X, y ? Max.Y : Min.Y, z ? Max.Z : Min.Z);
}
/// <summary>
/// Returns the configuration of the two furthest away corners.
/// </summary>
/// <param name="xyz">If true, it will take the maximum, otherwise the minimum.</param>
/// <returns></returns>
public Vector3 Get(bool xyz) => Get(xyz, xyz, xyz);
/// <summary>
/// Returns the configuration of one corner and applies a transformation to it.
/// <para>If the transformation causes the points to shift to no being in the right location is NOT checked!</para>
/// <para>For that use <see cref="GetBounds"/></para>
/// </summary>
/// <param name="transformation">The transformation</param>
/// <param name="x">If true, it takes the X-value of maximum, otherwise the minimum.</param>
/// <param name="y">If true, it takes the Y-value of maximum, otherwise the minimum.</param>
/// <param name="z">If true, it takes the Z-value of maximum, otherwise the minimum.</param>
/// <returns></returns>
public Vector3 Get(Matrix4 transformation, bool x, bool y, bool z)
{
Vector3 get = Get(x, y, z);
return (new Vector4(get, 1) * transformation).Xyz;
}
/// <summary>
/// Returns the configuration of the two furthest away corners.
/// <para>If the transformation causes the points to shift to no being in the right location is NOT checked!</para>
/// <para>For that use <see cref="GetBounds"/></para>
/// </summary>
/// <param name="transformation">The transformation</param>
/// <param name="xyz">If true, it will take the maximum, otherwise the minimum.</param>
/// <returns></returns>
public Vector3 Get(Matrix4 transformation, bool xyz) => Get(transformation, xyz, xyz, xyz);
/// <summary>
/// Returns the bounds of the bounding box while applying a transformation.
/// <para>This takes care of min and max locations.</para>
/// </summary>
/// <param name="transformation"></param>
/// <param name="min"></param>
/// <param name="max"></param>
public void GetBounds(Matrix4 transformation, out Vector3 min, out Vector3 max)
{
min = Get(transformation, false);
@ -79,6 +117,10 @@ namespace SM.OGL.Mesh
}
}
/// <summary>
/// Updates the bounding box to the mesh provided.
/// </summary>
/// <param name="mesh"></param>
public void Update(GenericMesh mesh)
{
int pos = 0;