Implemented new functions

This commit is contained in:
ANTON CERESKEVICS 2025-09-23 10:50:53 +01:00
parent e77901d4f0
commit 15eed5f7a6
6 changed files with 5267 additions and 8 deletions

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ResultsSessionDetails/>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ResultsSession>
<SessionData configName="Example Configuration" configPseudoUrl="c++test.user://Example Configuration" enabledAnalysis="Static" enabledHandlers="com.parasoft.xtest.checkers.api.scope.factory;com.parasoft.xtest.checkers.api.standards.factory" header="?? ??false??false??" runId="" startTime="1758617674937" tool="c++test">
<TestParameters cmdLn="C++test: -config c++test.user://Example Configuration "/>
<Authors/>
<Selection>
<Res id="TheRepo/TheLabs/Program.cs"/>
</Selection>
<XmlDataFiles/>
</SessionData>
<Locations/>
<CodingStandards>
<TestedFilesDetails>
<Total name="Suppressed / Total" supp="0" total="0"/>
</TestedFilesDetails>
</CodingStandards>
</ResultsSession>

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Numerics;
public class MyVector public class MyVector
{ {
@ -10,28 +11,45 @@ public class MyVector
public float W { get; private set; } public float W { get; private set; }
public MyVector(float pX, float pY, float pZ, float pW = 1) public MyVector(float pX, float pY, float pZ, float pW = 1)
{ {
this.W = pW;
this.X = pX;
this.Y = pY;
this.Z = pZ;
} }
public MyVector Add(MyVector pVector) public MyVector Add(MyVector pVector)
{ {
return null; Vector3 firstVector = new Vector3(X, Y, Z);
Vector3 secondVector = new Vector3(pVector.X, pVector.Y,pVector.Z);
Vector3 finishedVector = firstVector + secondVector;
return new MyVector(finishedVector.X, finishedVector.Y, finishedVector.Z);
} }
public MyVector Subtract(MyVector pVector) public MyVector Subtract(MyVector pVector)
{ {
return null; Vector3 firstVector = new Vector3(X, Y, Z);
Vector3 secondVector = new Vector3(pVector.X, pVector.Y, pVector.Z);
Vector3 finishedVector = firstVector - secondVector;
return new MyVector(finishedVector.X, finishedVector.Y, finishedVector.Z);
} }
public MyVector Multiply(float pScalar) public MyVector Multiply(float pScalar)
{ {
return null; Vector3 firstVector = new Vector3(X*pScalar, Y*pScalar, Z*pScalar);
return new MyVector(firstVector.X,firstVector.Y,firstVector.Z);
} }
public MyVector Divide(float pScalar) public MyVector Divide(float pScalar)
{ {
return null; Vector3 firstVector = new Vector3(X / pScalar, Y / pScalar, Z / pScalar);
return new MyVector(firstVector.X, firstVector.Y, firstVector.Z);
} }
public float Magnitude() public float Magnitude()
{ {
return -1; float squareSum = (float)Math.Pow(X, 2) + (float)Math.Pow(Y, 2) + (float)Math.Pow(Z, 2);
float SquareRoot = (float)Math.Sqrt(squareSum);
return SquareRoot;
} }
public MyVector Normalise() public MyVector Normalise()
{ {

View File

@ -13,7 +13,8 @@ namespace TheLabs
Size = new Vector2i(800, 600), Size = new Vector2i(800, 600),
Title = "My OpenTK Example Program" Title = "My OpenTK Example Program"
}; };
MyVector myVector = new MyVector(30, 40, 0);
Console.WriteLine(myVector.Magnitude());
using (var window = new MyExampleWindow(GameWindowSettings.Default, using (var window = new MyExampleWindow(GameWindowSettings.Default,
nativeWindowSettings)) nativeWindowSettings))
{ {

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>