Добавление операции Shorten для версоров / Adding of shortening operation for versors
This commit is contained in:
parent
df827ffe0e
commit
233c027d46
2 changed files with 82 additions and 26 deletions
|
|
@ -82,6 +82,16 @@ namespace BasicGeometry
|
|||
this.x3 = 0.0f;
|
||||
}
|
||||
|
||||
public void Shorten()
|
||||
{
|
||||
if (this.s0 < 0.0f) {
|
||||
this.s0 = -this.s0;
|
||||
this.x1 = -this.x1;
|
||||
this.x2 = -this.x2;
|
||||
this.x3 = -this.x3;
|
||||
}
|
||||
}
|
||||
|
||||
public void Invert()
|
||||
{
|
||||
this.x1 = -this.x1;
|
||||
|
|
@ -186,10 +196,11 @@ namespace BasicGeometry
|
|||
|
||||
public void SetValues(in FP64Versor versor)
|
||||
{
|
||||
this.s0 = (float) versor.GetScalar();
|
||||
this.x1 = (float) versor.GetX1();
|
||||
this.x2 = (float) versor.GetX2();
|
||||
this.x3 = (float) versor.GetX3();
|
||||
this.SetValues(
|
||||
(float) versor.GetScalar(),
|
||||
(float) versor.GetX1(),
|
||||
(float) versor.GetX2(),
|
||||
(float) versor.GetX3());
|
||||
}
|
||||
|
||||
public void SetInverted(in FP32Versor versor)
|
||||
|
|
@ -202,10 +213,35 @@ namespace BasicGeometry
|
|||
|
||||
public void SetInverted(in FP64Versor versor)
|
||||
{
|
||||
this.s0 = (float) versor.GetScalar();
|
||||
this.x1 = (float) -versor.GetX1();
|
||||
this.x2 = (float) -versor.GetX2();
|
||||
this.x3 = (float) -versor.GetX3();
|
||||
this.SetValues(
|
||||
(float)versor.GetScalar(),
|
||||
(float)-versor.GetX1(),
|
||||
(float)-versor.GetX2(),
|
||||
(float)-versor.GetX3());
|
||||
}
|
||||
|
||||
public void SetShortened(in FP32Versor versor)
|
||||
{
|
||||
if (versor.s0 < 0.0f)
|
||||
{
|
||||
this.s0 = -versor.s0;
|
||||
this.x1 = -versor.x1;
|
||||
this.x2 = -versor.x2;
|
||||
this.x3 = -versor.x3;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.s0 = versor.s0;
|
||||
this.x1 = versor.x1;
|
||||
this.x2 = versor.x2;
|
||||
this.x3 = versor.x3;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetShortened(in FP64Versor versor)
|
||||
{
|
||||
this.SetValues(versor);
|
||||
this.Shorten();
|
||||
}
|
||||
|
||||
public readonly void Turn(in FP32Vector3 vector, out FP32Vector3 result)
|
||||
|
|
|
|||
|
|
@ -44,12 +44,7 @@ namespace BasicGeometry
|
|||
|
||||
public FP64Versor(in FP32Versor versor)
|
||||
{
|
||||
LoadValues(
|
||||
versor.GetScalar(),
|
||||
versor.GetX1(),
|
||||
versor.GetX2(),
|
||||
versor.GetX3(),
|
||||
out this);
|
||||
LoadValues(versor.GetScalar(), versor.GetX1(), versor.GetX2(), versor.GetX3(), out this);
|
||||
}
|
||||
|
||||
public readonly double GetScalar()
|
||||
|
|
@ -85,6 +80,17 @@ namespace BasicGeometry
|
|||
this.x3 = 0.0;
|
||||
}
|
||||
|
||||
public void Shorten()
|
||||
{
|
||||
if (this.s0 < 0.0)
|
||||
{
|
||||
this.s0 = -this.s0;
|
||||
this.x1 = -this.x1;
|
||||
this.x2 = -this.x2;
|
||||
this.x3 = -this.x3;
|
||||
}
|
||||
}
|
||||
|
||||
public void Invert()
|
||||
{
|
||||
this.x1 = -this.x1;
|
||||
|
|
@ -190,12 +196,31 @@ namespace BasicGeometry
|
|||
|
||||
public void SetValues(in FP32Versor versor)
|
||||
{
|
||||
LoadValues(
|
||||
versor.GetScalar(),
|
||||
versor.GetX1(),
|
||||
versor.GetX2(),
|
||||
versor.GetX3(),
|
||||
out this);
|
||||
this.SetValues(versor.GetScalar(), versor.GetX1(), versor.GetX2(), versor.GetX3());
|
||||
}
|
||||
|
||||
public void SetShortened(in FP64Versor versor)
|
||||
{
|
||||
if (versor.s0 < 0.0)
|
||||
{
|
||||
this.s0 = -versor.s0;
|
||||
this.x1 = -versor.x1;
|
||||
this.x2 = -versor.x2;
|
||||
this.x3 = -versor.x3;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.s0 = versor.s0;
|
||||
this.x1 = versor.x1;
|
||||
this.x2 = versor.x2;
|
||||
this.x3 = versor.x3;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetShortened(in FP32Versor versor)
|
||||
{
|
||||
this.SetValues(versor);
|
||||
this.Shorten();
|
||||
}
|
||||
|
||||
public void SetInverted(in FP64Versor versor)
|
||||
|
|
@ -208,12 +233,7 @@ namespace BasicGeometry
|
|||
|
||||
public void SetInverted(in FP32Versor versor)
|
||||
{
|
||||
LoadValues(
|
||||
versor.GetScalar(),
|
||||
versor.GetX1(),
|
||||
versor.GetX2(),
|
||||
versor.GetX3(),
|
||||
out this);
|
||||
this.SetValues(versor.GetScalar(), -versor.GetX1(), -versor.GetX2(), -versor.GetX3());
|
||||
}
|
||||
|
||||
public readonly void Turn(in FP64Vector3 vector, out FP64Vector3 result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue