Completed vector resting

This commit is contained in:
zyb3rwolfi 2025-09-23 13:18:18 +01:00
parent 15eed5f7a6
commit beb8c2460e
7 changed files with 65 additions and 5 deletions

13
TheRepo/.idea/.idea.TheRepo/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/contentModel.xml
/.idea.TheRepo.iml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders>
<Path>../../551455-graphics-programming-2526-the-repo-Zyb3rWolfi</Path>
</attachedFolders>
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -53,23 +53,41 @@ public class MyVector
}
public MyVector Normalise()
{
return null;
float mag = Magnitude();
return new MyVector(X / mag, Y / mag, Z / mag);
}
public float DotProduct(MyVector pVector)
{
return -1;
float dotProduct = (X * pVector.X) + (Y * pVector.Y) + (Z * pVector.Z);
return dotProduct;
}
public MyVector Interpolate(MyVector pVector, float pInterpolation)
{
return null;
return new MyVector(
X + (pVector.X - X) * pInterpolation,
Y + (pVector.Y - Y) * pInterpolation,
Z + (pVector.Z - Z) * pInterpolation
);
}
public float AngleBetween(MyVector pVector)
{
return -1;
float dot = DotProduct(pVector);
float magA = Magnitude();
float magB = pVector.Magnitude();
float cosAngle = dot / (magA * magB);
cosAngle = Math.Clamp(cosAngle, -1.0f, 1.0f);
return (float)Math.Acos(cosAngle);
}
public MyVector CrossProduct(MyVector pVector)
{
return null;
return new MyVector(
(Y * pVector.Z) - (Z * pVector.Y),
(Z * pVector.X) - (X * pVector.Z),
(X * pVector.Y) - (Y * pVector.X)
);
}
}

View File

@ -14,6 +14,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="OpenTK" Version="4.8.2" />
</ItemGroup>
<ItemGroup>