8000 feat: exposed reflection as transformation by cesarecaoduro · Pull Request #385 · GSharker/G-Shark · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: exposed reflection as transformation #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/GShark.Test.XUnit/Core/TransformTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,5 +262,21 @@ public void It_Returns_A_Rotation_Matrix_From_Angle_Axis_And_Center_Point()
rotationMatrix.Equals(expectedMatrix).Should().BeTrue();
}

[Fact]
public void It_Returns_A_Point_Reflected_On_The_YZ_Plane()
{
var p = new Point3(5, 0, 0);

//Act
var reflectionMatrix = Transform.Reflection(Plane.PlaneYZ);
var pReflected = p.Transform(reflectionMatrix);

//Assert
#if DEBUG
_testOutput.WriteLine(pReflected.ToString());
#endif
pReflected.Should().BeEquivalentTo(new Point3(-5, 0, 0));
8000 }

}
}
2 changes: 1 addition & 1 deletion src/GShark.Test.XUnit/GShark.Test.XUnit.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>

Expand Down
10 changes: 10 additions & 0 deletions src/GShark/Core/Transform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,15 @@ public static TransformMatrix PlaneToPlane(Plane a, Plane b)

return result;
}

/// <summary>
/// Creates a reflection transformation matrix given a Plane defining the plane of reflection.
/// </summary>
/// <param name="a">The plane used to reflect.</param>
/// <returns>The transformation matrix.</returns>
public static TransformMatrix Reflection(Plane a)
{
return TransformMatrix.Reflection(a);
}
}
}
0