using XFEEDToolBox.Core.Galaxy;
using XFEEDToolBox.Core.Models;
using XFEExtension.NetCore.XUnit.Attributes;
namespace XFEEDToolBox.Test;
[TestFixture]
public sealed class GalaxyStellarStyleTests
{
[Test] public void ActualGiantClassNamesHaveLargerPhotospheresThanMainSequenceStars()
{
Check.Equal(1f,StellarAppearance.PhysicalRadius("K"));
Check.That(StellarAppearance.PhysicalRadius("K_OrangeGiant")>StellarAppearance.PhysicalRadius("K"));
Check.That(StellarAppearance.PhysicalRadius("M_RedSuperGiant")>StellarAppearance.PhysicalRadius("M_RedGiant"));
Check.Equal(1f,StellarAppearance.PhysicalRadius("Unknown"));
}
[Test] public void AllocationFreeStalkProjectionMatchesWorldSegmentProjectionAtTheMovingGridPlane()
{
var camera=GalaxyCamera.Create(new(10,20,30),1280,720,.3,-.45,4,30,-20);
foreach(var star in new[]{new Coordinates(14,35,37),new(0,-10,50),new(20,25,20)})
{
var projected=GalaxyMapGeometry.TryProjectStalk(camera,star,out var actual);
var regular=GalaxyMapGeometry.TryProjectSegment(camera,star,new(star.X,camera.Focus.Y,star.Z),out var expected);
Check.Equal(regular,projected);if(!projected)continue;
Check.That(Math.Abs(actual.X1-expected.X1)<1e-7&&Math.Abs(actual.Y1-expected.Y1)<1e-7);
Check.That(Math.Abs(actual.X2-expected.X2)<1e-7&&Math.Abs(actual.Y2-expected.Y2)<1e-7);
}
Check.That(!GalaxyMapGeometry.TryProjectStalk(camera,new(0,camera.Focus.Y,0),out _));
}
}
using XFEEDToolBox.Core.Galaxy;
using XFEEDToolBox.Core.Models;
using XFEExtension.NetCore.XUnit.Attributes;
namespace XFEEDToolBox.Test;
[TestFixture]
public sealed class GalaxyStellarStyleTests
{
[Test] public void ActualGiantClassNamesHaveLargerPhotospheresThanMainSequenceStars()
{
Check.Equal(1f,StellarAppearance.PhysicalRadius("K"));
Check.That(StellarAppearance.PhysicalRadius("K_OrangeGiant")>StellarAppearance.PhysicalRadius("K"));
Check.That(StellarAppearance.PhysicalRadius("M_RedSuperGiant")>StellarAppearance.PhysicalRadius("M_RedGiant"));
Check.Equal(1f,StellarAppearance.PhysicalRadius("Unknown"));
}
[Test] public void AllocationFreeStalkProjectionMatchesWorldSegmentProjectionAtTheMovingGridPlane()
{
var camera=GalaxyCamera.Create(new(10,20,30),1280,720,.3,-.45,4,30,-20);
foreach(var star in new[]{new Coordinates(14,35,37),new(0,-10,50),new(20,25,20)})
{
var projected=GalaxyMapGeometry.TryProjectStalk(camera,star,out var actual);
var regular=GalaxyMapGeometry.TryProjectSegment(camera,star,new(star.X,camera.Focus.Y,star.Z),out var expected);
Check.Equal(regular,projected);if(!projected)continue;
Check.That(Math.Abs(actual.X1-expected.X1)<1e-7&&Math.Abs(actual.Y1-expected.Y1)<1e-7);
Check.That(Math.Abs(actual.X2-expected.X2)<1e-7&&Math.Abs(actual.Y2-expected.Y2)<1e-7);
}
Check.That(!GalaxyMapGeometry.TryProjectStalk(camera,new(0,camera.Focus.Y,0),out _));
}
}