moved math things to other repository
[https://github.com/firedef/MathStuff]
This commit is contained in:
Родитель
fb14f20e55
Коммит
71e7c43122
|
@ -1,4 +1,3 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using SomeChartsAvaloniaExamples.elements;
|
||||
|
||||
namespace SomeChartsAvaloniaExamples {
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<PackageReference Include="Avalonia.Desktop" Version="0.10.12" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.12" />
|
||||
<PackageReference Include="MathStuff" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SomeChartsUiAvalonia\SomeChartsUiAvalonia.csproj" />
|
||||
|
|
|
@ -2,14 +2,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.OpenGL;
|
||||
using Avalonia.OpenGL.Angle;
|
||||
using Avalonia.OpenGL.Controls;
|
||||
using Avalonia.OpenGL.Egl;
|
||||
using Avalonia.Threading;
|
||||
using SomeChartsUiAvalonia.controls;
|
||||
using SomeChartsUiAvalonia.controls.gl;
|
||||
using SomeChartsUiAvalonia.controls.skia;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.data;
|
||||
using SomeChartsUi.elements;
|
||||
using SomeChartsUi.elements.charts.line;
|
||||
|
@ -8,11 +8,7 @@ using SomeChartsUi.elements.other;
|
|||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.themes.themes;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.utils;
|
||||
using SomeChartsUi.utils.mesh;
|
||||
using SomeChartsUi.utils.shaders;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using SomeChartsUiAvalonia.controls;
|
||||
using SomeChartsUiAvalonia.controls.gl;
|
||||
using SomeChartsUiAvalonia.controls.skia;
|
||||
using SomeChartsUiAvalonia.utils;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MathStuff" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
using NUnit.Framework;
|
||||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.utils.collections;
|
||||
using SomeChartsUi.utils.mesh;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsTests;
|
||||
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Threading;
|
||||
using NUnit.Framework;
|
||||
using SomeChartsAvaloniaExamples;
|
||||
using SomeChartsUiAvalonia;
|
||||
using SomeChartsUiAvalonia.utils;
|
||||
|
||||
namespace SomeChartsTests.avalonia;
|
||||
|
||||
|
|
|
@ -25,26 +25,14 @@
|
|||
<Folder Include="src\elements\charts\radar" />
|
||||
<Folder Include="src\elements\charts\scatter" />
|
||||
<Folder Include="src\elements\ui" />
|
||||
<Folder Include="src\utils\rects" />
|
||||
<Folder Include="src\utils\vectors" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MathStuff" Version="1.0.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="7.0.0-preview.1.22076.8" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="src\utils\vectors\vectorGen.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>vectorGen.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="src\utils\vectors\vectorGen.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>vectorGen.tt</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
using SomeChartsUi.themes.colors;
|
||||
using MathStuff;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.ui.text;
|
||||
using SomeChartsUi.utils.mesh;
|
||||
using SomeChartsUi.utils.rects;
|
||||
using SomeChartsUi.utils.shaders;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.backends;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using MathStuff.vectors;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.data;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Buffers;
|
||||
using MathStuff;
|
||||
using SomeChartsUi.themes.colors;
|
||||
|
||||
namespace SomeChartsUi.data;
|
||||
|
|
|
@ -2,7 +2,6 @@ using SomeChartsUi.data;
|
|||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.elements.charts.line;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ using SomeChartsUi.themes.themes;
|
|||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.ui.text;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.elements.other;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using SomeChartsUi.themes.colors;
|
||||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.utils.mesh;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.elements.other;
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.data;
|
||||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.themes.themes;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.ui.text;
|
||||
using SomeChartsUi.utils;
|
||||
using SomeChartsUi.utils.rects;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.elements.other;
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
using SomeChartsUi.themes.colors;
|
||||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.utils.mesh;
|
||||
using SomeChartsUi.utils.rects;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.elements.other;
|
||||
|
||||
|
|
|
@ -1,278 +0,0 @@
|
|||
namespace SomeChartsUi.themes.colors;
|
||||
|
||||
public struct color {
|
||||
public const int sizeOf = 4;
|
||||
|
||||
public static readonly color white = new(1f, 1f, 1f);
|
||||
public static readonly color black = new(0f, 0f, 0f);
|
||||
public static readonly color transparent = new(0f, 0f, 0f, 0f);
|
||||
public static readonly color red = new(1f, 0f, 0f);
|
||||
public static readonly color green = new(0f, 1f, 0f);
|
||||
public static readonly color blue = new(0f, 0f, 1f);
|
||||
|
||||
public static readonly color yellow = new(1f, 1f, 0f);
|
||||
public static readonly color purple = new(1f, 0f, 1f);
|
||||
public static readonly color cyan = new(0f, 1f, 1f);
|
||||
|
||||
public static readonly color softRed = new(1f, .5f, .5f);
|
||||
public static readonly color softGreen = new(.5f, 1f, .5f);
|
||||
public static readonly color softBlue = new(.5f, .5f, 1f);
|
||||
public static readonly color softYellow = new(1f, 1f, .5f);
|
||||
public static readonly color softPurple = new(1f, .5f, 1f);
|
||||
public static readonly color softCyan = new(.5f, 1f, 1f);
|
||||
|
||||
public static readonly color steelBlue = "#242A3D";
|
||||
public static readonly color steelBlueLight = "#3f4966";
|
||||
public static readonly color steelBlueLighter = "#515e87";
|
||||
public static readonly color steelBlueLightest = "#5e71ad";
|
||||
public static readonly color steelBlueLightest2 = "#667dc4";
|
||||
public static readonly color steelBlueLightest3 = "#7995ed";
|
||||
public static readonly color steelBlueLightest4 = "#abbfff";
|
||||
public static readonly color steelBlueLightest5 = "#bfcfff";
|
||||
|
||||
private const float _oneDiv255 = 1 / 255f;
|
||||
public uint raw;
|
||||
|
||||
public color(uint raw) => this.raw = raw;
|
||||
|
||||
public color(byte r, byte g, byte b, byte a = 255) : this((uint)((a << 24) | (r << 16) | (g << 8) | b)) { }
|
||||
|
||||
public color(float r, float g, float b, float a = 1) : this() {
|
||||
aF = a;
|
||||
rF = r;
|
||||
gF = g;
|
||||
bF = b;
|
||||
}
|
||||
|
||||
public byte a {
|
||||
get => (byte)((raw >> 24) & 0xff);
|
||||
set => raw = (raw & 0x00_ff_ff_ff) | ((uint)value << 24);
|
||||
}
|
||||
|
||||
public byte r {
|
||||
get => (byte)((raw >> 16) & 0xff);
|
||||
set => raw = (raw & 0xff_00_ff_ff) | ((uint)value << 16);
|
||||
}
|
||||
|
||||
public byte g {
|
||||
get => (byte)((raw >> 8) & 0xff);
|
||||
set => raw = (raw & 0xff_ff_00_ff) | ((uint)value << 8);
|
||||
}
|
||||
|
||||
public byte b {
|
||||
get => (byte)(raw & 0xff);
|
||||
set => raw = (raw & 0xff_ff_ff_00) | value;
|
||||
}
|
||||
|
||||
public float aF {
|
||||
get => a * _oneDiv255;
|
||||
set => a = (byte)(value >= 1 ? 255 : value <= 0 ? 0 : value * 255);
|
||||
}
|
||||
|
||||
public float rF {
|
||||
get => r * _oneDiv255;
|
||||
set => r = (byte)(value >= 1 ? 255 : value <= 0 ? 0 : value * 255);
|
||||
}
|
||||
|
||||
public float gF {
|
||||
get => g * _oneDiv255;
|
||||
set => g = (byte)(value >= 1 ? 255 : value <= 0 ? 0 : value * 255);
|
||||
}
|
||||
|
||||
public float bF {
|
||||
get => b * _oneDiv255;
|
||||
set => b = (byte)(value >= 1 ? 255 : value <= 0 ? 0 : value * 255);
|
||||
}
|
||||
|
||||
public float value => Math.Max(r, Math.Max(g, b)) * _oneDiv255;
|
||||
public float minValue => Math.Min(r, Math.Min(g, b)) * _oneDiv255;
|
||||
public float chroma => value - minValue;
|
||||
public float lightness => (value + minValue) * .5f;
|
||||
|
||||
public float hue {
|
||||
get {
|
||||
float fR = rF;
|
||||
float fG = gF;
|
||||
float fB = bF;
|
||||
float minV = minValue;
|
||||
float maxV = value;
|
||||
float chromaV = maxV - minV;
|
||||
float h = 0.0f;
|
||||
|
||||
if (!(Math.Abs(chromaV) > .001)) return h * 360;
|
||||
float num4 = ((maxV - fR) / 6.0f + chromaV * .5f) / chromaV;
|
||||
float num5 = ((maxV - fG) / 6.0f + chromaV * .5f) / chromaV;
|
||||
float num6 = ((maxV - fB) / 6.0f + chromaV * .5f) / chromaV;
|
||||
h = Math.Abs(fR - maxV) >= .001
|
||||
? Math.Abs(fG - maxV) >= .001
|
||||
? 0.6666667f + num5 - num4
|
||||
: 0.33333334f + num4 - num6
|
||||
: num6 - num5;
|
||||
if (h < 0) ++h;
|
||||
if (h > 1) --h;
|
||||
return h;
|
||||
}
|
||||
}
|
||||
|
||||
public float saturation {
|
||||
get {
|
||||
float minV = minValue;
|
||||
float maxV = value;
|
||||
float chromaV = maxV - minV;
|
||||
float s = 0.0f;
|
||||
float l = (maxV + minV) * .5f;
|
||||
if (Math.Abs(chromaV) > .001) s = l >= 0.5 ? chromaV / (2f - maxV - minV) : chromaV / (maxV + minV);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
public (float h, float s, float l) hsl {
|
||||
get {
|
||||
float fR = rF;
|
||||
float fG = gF;
|
||||
float fB = bF;
|
||||
float minV = minValue;
|
||||
float maxV = value;
|
||||
float chromaV = maxV - minV;
|
||||
float h = 0.0f;
|
||||
float s = 0.0f;
|
||||
float l = (maxV + minV) * .5f;
|
||||
if (!(Math.Abs(chromaV) > .001)) return (h, s, l);
|
||||
|
||||
s = l >= 0.5 ? chromaV / (2f - maxV - minV) : chromaV / (maxV + minV);
|
||||
float num4 = ((maxV - fR) / 6.0f + chromaV * .5f) / chromaV;
|
||||
float num5 = ((maxV - fG) / 6.0f + chromaV * .5f) / chromaV;
|
||||
float num6 = ((maxV - fB) / 6.0f + chromaV * .5f) / chromaV;
|
||||
h = Math.Abs(fR - maxV) >= .001
|
||||
? Math.Abs(fG - maxV) >= .001
|
||||
? 0.6666667f + num5 - num4
|
||||
: 0.33333334f + num4 - num6
|
||||
: num6 - num5;
|
||||
if (h < 0) ++h;
|
||||
if (h > 1) --h;
|
||||
|
||||
return (h, s, l);
|
||||
}
|
||||
}
|
||||
|
||||
public color WithHue(float v) {
|
||||
(float h, float s, float l) hslV = hsl;
|
||||
hslV.h = v;
|
||||
return FromHsl(hslV);
|
||||
}
|
||||
|
||||
public color WithSaturation(float v) {
|
||||
(float h, float s, float l) hslV = hsl;
|
||||
hslV.s = v;
|
||||
return FromHsl(hslV);
|
||||
}
|
||||
|
||||
public color WithLightness(float v) {
|
||||
(float h, float s, float l) hslV = hsl;
|
||||
hslV.l = v;
|
||||
return FromHsl(hslV);
|
||||
}
|
||||
|
||||
public readonly color WithAlpha(byte v) => new(r, g, b, v);
|
||||
public color WithBlue(byte v) => new(r, g, v, a);
|
||||
public color WithGreen(byte v) => new(r, v, g, a);
|
||||
public color WithRed(byte v) => new(v, r, g, a);
|
||||
|
||||
public color WithInvertedLightness() {
|
||||
(float h, float s, float l) hslV = hsl;
|
||||
hslV.l = 1 - hslV.l;
|
||||
return FromHsl(hslV);
|
||||
}
|
||||
|
||||
public static implicit operator (float r, float g, float b, float a)(color v) => (v.rF, v.gF, v.bF, v.aF);
|
||||
public static implicit operator (double r, double g, double b, double a)(color v) => (v.rF, v.gF, v.bF, v.aF);
|
||||
public static implicit operator (double r, double g, double b)(color v) => (v.rF, v.gF, v.bF);
|
||||
public static implicit operator color((float r, float g, float b, float a) v) => new(v.r, v.g, v.b, v.a);
|
||||
public static implicit operator color((double r, double g, double b, double a) v) => new((float)v.r, (float)v.g, (float)v.b, (float)v.a);
|
||||
|
||||
// public static implicit operator SKColor(color v) => new(v.raw);
|
||||
// public static implicit operator color(SKColor v) => new(v.Red, v.Green, v.Blue, v.Alpha);
|
||||
|
||||
// public static implicit operator Color(color v) => new(v.a, v.r, v.g, v.b);
|
||||
// public static implicit operator color(Color v) => new(v.R, v.G, v.B, v.A);
|
||||
|
||||
// public static implicit operator SolidColorBrush(color v) => new(v);
|
||||
// public static implicit operator color(SolidColorBrush v) => v.Color;
|
||||
|
||||
public static implicit operator color(string v) {
|
||||
if (string.IsNullOrEmpty(v)) return black;
|
||||
if (v[0] == '#') v = v[1..v.Length];
|
||||
|
||||
return v.Length switch {
|
||||
3 => new(Parse1_(v[0]), // r
|
||||
Parse1_(v[1]), // g
|
||||
Parse1_(v[2])), // b
|
||||
4 => new(Parse1_(v[0]), // r
|
||||
Parse1_(v[1]), // g
|
||||
Parse1_(v[2]), // b
|
||||
Parse1_(v[3])), // a
|
||||
6 => new(Parse2_(v[0], v[1]), // r
|
||||
Parse2_(v[2], v[3]), // g
|
||||
Parse2_(v[4], v[5])), // b
|
||||
8 => new(Parse2_(v[0], v[1]), // r
|
||||
Parse2_(v[2], v[3]), // g
|
||||
Parse2_(v[4], v[5]), // b
|
||||
Parse2_(v[6], v[7])), // a
|
||||
_ => black
|
||||
};
|
||||
|
||||
float Parse1_(char c) => ParseChar_(c) / 15f;
|
||||
float Parse2_(char a, char b) => (ParseChar_(a) * 16 + ParseChar_(b)) / 255f;
|
||||
|
||||
float ParseChar_(char c) {
|
||||
return c switch {
|
||||
'0' => 0,
|
||||
'1' => 1,
|
||||
'2' => 2,
|
||||
'3' => 3,
|
||||
'4' => 4,
|
||||
'5' => 5,
|
||||
'6' => 6,
|
||||
'7' => 7,
|
||||
'8' => 8,
|
||||
'9' => 9,
|
||||
'a' or 'A' => 10,
|
||||
'b' or 'B' => 11,
|
||||
'c' or 'C' => 12,
|
||||
'd' or 'D' => 13,
|
||||
'e' or 'E' => 14,
|
||||
'f' or 'F' => 15,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(c), c, null)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static color FromHsl((float h, float s, float l) v, float a = 1f) {
|
||||
float r = v.l;
|
||||
float g = v.l;
|
||||
float b = v.l;
|
||||
if (!(Math.Abs(v.s) > 0.001)) return new(r, g, b, a);
|
||||
float v2 = v.l >= 0.5 ? v.l + v.s - v.s * v.l : v.l * (1f + v.s);
|
||||
float v1 = 2f * v.l - v2;
|
||||
r = HueToRgb(v1, v2, v.h + 0.33333334f);
|
||||
g = HueToRgb(v1, v2, v.h);
|
||||
b = HueToRgb(v1, v2, v.h - 0.33333334f);
|
||||
return new(r, g, b, a);
|
||||
}
|
||||
|
||||
private static float HueToRgb(float v1, float v2, float vH) {
|
||||
if (vH < 0) ++vH;
|
||||
if (vH > 1) --vH;
|
||||
if (6.0 * vH < 1) return v1 + (v2 - v1) * 6 * vH;
|
||||
if (2.0 * vH < 1) return v2;
|
||||
return 3.0 * vH < 2.0 ? v1 + (v2 - v1) * (0.6666666865348816f - vH) * 6 : v1;
|
||||
}
|
||||
|
||||
public static color Lerp(color a, color b, float t) => new(
|
||||
a.rF * (1 - t) + b.rF * t,
|
||||
a.gF * (1 - t) + b.gF * t,
|
||||
a.bF * (1 - t) + b.bF * t,
|
||||
a.aF * (1 - t) + b.aF * t);
|
||||
|
||||
public override string ToString() => $"#{raw:x8}";
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
using MathStuff;
|
||||
using SomeChartsUi.themes.palettes;
|
||||
using SomeChartsUi.themes.themes;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using SomeChartsUi.themes.colors;
|
||||
using MathStuff;
|
||||
|
||||
namespace SomeChartsUi.themes.palettes;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using SomeChartsUi.themes.colors;
|
||||
using MathStuff;
|
||||
|
||||
namespace SomeChartsUi.themes.themes;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using SomeChartsUi.themes.colors;
|
||||
using MathStuff;
|
||||
using SomeChartsUi.themes.palettes;
|
||||
using SomeChartsUi.utils;
|
||||
|
||||
namespace SomeChartsUi.themes.themes;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using SomeChartsUi.themes.colors;
|
||||
using MathStuff;
|
||||
using SomeChartsUi.themes.palettes;
|
||||
|
||||
namespace SomeChartsUi.themes.themes;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.ui.canvas.animation;
|
||||
using SomeChartsUi.utils.rects;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.ui.canvas;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using SomeChartsUi.utils.vectors;
|
||||
using MathStuff.vectors;
|
||||
|
||||
namespace SomeChartsUi.ui.canvas;
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.ui.canvas.animation;
|
||||
|
||||
public class CanvasAnimVariable<T> : ICanvasUpdate where T : unmanaged {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
using SomeChartsUi.data;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.themes.themes;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.ui.canvas.controls;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using SomeChartsUi.utils.vectors;
|
||||
using MathStuff.vectors;
|
||||
|
||||
namespace SomeChartsUi.ui.canvas.controls;
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
using SomeChartsUi.data;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.utils.mesh;
|
||||
using SomeChartsUi.utils.shaders;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.ui.elements;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.elements;
|
||||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.ui.text;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.ui.elements;
|
||||
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
using System.Buffers;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.data;
|
||||
using SomeChartsUi.elements;
|
||||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.text;
|
||||
using SomeChartsUi.utils;
|
||||
using SomeChartsUi.utils.shaders;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.ui.elements;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using SomeChartsUi.utils.vectors;
|
||||
using MathStuff.vectors;
|
||||
|
||||
namespace SomeChartsUi.ui.elements;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.utils.rects;
|
||||
|
||||
namespace SomeChartsUi.ui.layers;
|
||||
|
||||
|
|
|
@ -1,677 +0,0 @@
|
|||
/*
|
||||
* This file is generated using T4 (Tachyon5/src/utils/Mathematics/MathGen.tt)
|
||||
* Any changes will be reset on template update
|
||||
*/
|
||||
|
||||
namespace SomeChartsUi.utils;
|
||||
|
||||
public static partial class math {
|
||||
// * region floatOps : math and other useful operations with float
|
||||
#region floatOps
|
||||
|
||||
public static float min(float a, float b) => a >= b ? b : a;
|
||||
public static float min(float a, float b, float c) => min(a, min(b, c));
|
||||
public static float min(float a, float b, float c, float d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static float max(float a, float b) => a >= b ? a : b;
|
||||
public static float max(float a, float b, float c) => max(a, max(b, c));
|
||||
public static float max(float a, float b, float c, float d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static float pow2(float v) => v * v;
|
||||
public static float pow3(float v) => v * v * v;
|
||||
public static float pow4(float v) => v * v * v * v;
|
||||
public static float pow(float v, int e) {
|
||||
float result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static float log10(float v) => MathF.Log10(v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static float log2(float v) => MathF.Log2(v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static float log(float v) => MathF.Log(v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static float log(float v, float b) => MathF.Log(v, b);
|
||||
|
||||
public static float sqrt(float v) => MathF.Sqrt(v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static float clamp(float v, float a, float b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static float lerp(float a, float b, float t) => a * (1 - t) + b * t;
|
||||
|
||||
public static float abs(float a) => a < 0 ? -a : a;
|
||||
|
||||
|
||||
public static unsafe uint bitCastInt(float v) => *(uint*)&v;
|
||||
public static unsafe uint bitCastInt(float* v) => *(uint*)v;
|
||||
|
||||
public static unsafe float bitCastFloatFromInt(uint v) => *(float*)&v;
|
||||
public static unsafe float bitCastFloatFromInt(uint* v) => *(float*)v;
|
||||
|
||||
public static unsafe T bitCast<T>(float v) where T : unmanaged => *(T*)&v;
|
||||
public static unsafe T bitCast<T>(float* v) where T : unmanaged => *(T*)v;
|
||||
|
||||
public static unsafe float nextValue(float v) => *(float*)(*(uint*)&v + 1);
|
||||
public static unsafe float nextValue(float* v) => *(float*)(*(uint*)v + 1);
|
||||
|
||||
public static unsafe float previousValue(float v) => *(float*)(*(uint*)&v - 1);
|
||||
public static unsafe float previousValue(float* v) => *(float*)(*(uint*)v - 1);
|
||||
|
||||
#endregion floatOps
|
||||
|
||||
// * region doubleOps : math and other useful operations with double
|
||||
#region doubleOps
|
||||
|
||||
public static double min(double a, double b) => a >= b ? b : a;
|
||||
public static double min(double a, double b, double c) => min(a, min(b, c));
|
||||
public static double min(double a, double b, double c, double d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static double max(double a, double b) => a >= b ? a : b;
|
||||
public static double max(double a, double b, double c) => max(a, max(b, c));
|
||||
public static double max(double a, double b, double c, double d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static double pow2(double v) => v * v;
|
||||
public static double pow3(double v) => v * v * v;
|
||||
public static double pow4(double v) => v * v * v * v;
|
||||
public static double pow(double v, int e) {
|
||||
double result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static double log10(double v) => Math.Log10(v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static double log2(double v) => Math.Log2(v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static double log(double v) => Math.Log(v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static double log(double v, double b) => Math.Log(v, b);
|
||||
|
||||
public static double sqrt(double v) => Math.Sqrt(v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static double clamp(double v, double a, double b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static double lerp(double a, double b, double t) => a * (1 - t) + b * t;
|
||||
|
||||
public static double abs(double a) => a < 0 ? -a : a;
|
||||
|
||||
|
||||
public static unsafe ulong bitCastInt(double v) => *(ulong*)&v;
|
||||
public static unsafe ulong bitCastInt(double* v) => *(ulong*)v;
|
||||
|
||||
public static unsafe double bitCastDoubleFromInt(ulong v) => *(double*)&v;
|
||||
public static unsafe double bitCastDoubleFromInt(ulong* v) => *(double*)v;
|
||||
|
||||
public static unsafe T bitCast<T>(double v) where T : unmanaged => *(T*)&v;
|
||||
public static unsafe T bitCast<T>(double* v) where T : unmanaged => *(T*)v;
|
||||
|
||||
public static unsafe double nextValue(double v) => *(double*)(*(ulong*)&v + 1);
|
||||
public static unsafe double nextValue(double* v) => *(double*)(*(ulong*)v + 1);
|
||||
|
||||
public static unsafe double previousValue(double v) => *(double*)(*(ulong*)&v - 1);
|
||||
public static unsafe double previousValue(double* v) => *(double*)(*(ulong*)v - 1);
|
||||
|
||||
#endregion doubleOps
|
||||
|
||||
// * region decimalOps : math and other useful operations with decimal
|
||||
#region decimalOps
|
||||
|
||||
public static decimal min(decimal a, decimal b) => a >= b ? b : a;
|
||||
public static decimal min(decimal a, decimal b, decimal c) => min(a, min(b, c));
|
||||
public static decimal min(decimal a, decimal b, decimal c, decimal d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static decimal max(decimal a, decimal b) => a >= b ? a : b;
|
||||
public static decimal max(decimal a, decimal b, decimal c) => max(a, max(b, c));
|
||||
public static decimal max(decimal a, decimal b, decimal c, decimal d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static decimal pow2(decimal v) => v * v;
|
||||
public static decimal pow3(decimal v) => v * v * v;
|
||||
public static decimal pow4(decimal v) => v * v * v * v;
|
||||
public static decimal pow(decimal v, int e) {
|
||||
decimal result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static double log10(decimal v) => Math.Log10((double)v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static double log2(decimal v) => Math.Log2((double)v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static double log(decimal v) => Math.Log((double)v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static double log(decimal v, double b) => Math.Log((double)v, b);
|
||||
|
||||
public static double sqrt(decimal v) => Math.Sqrt((double)v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static decimal clamp(decimal v, decimal a, decimal b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static decimal lerp(decimal a, decimal b, double t) => a * (decimal)(1 - t) + b * (decimal)t;
|
||||
|
||||
public static decimal abs(decimal a) => a < 0 ? -a : a;
|
||||
|
||||
#endregion decimalOps
|
||||
|
||||
// * region byteOps : math and other useful operations with byte
|
||||
#region byteOps
|
||||
|
||||
public static byte min(byte a, byte b) => a >= b ? b : a;
|
||||
public static byte min(byte a, byte b, byte c) => min(a, min(b, c));
|
||||
public static byte min(byte a, byte b, byte c, byte d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static byte max(byte a, byte b) => a >= b ? a : b;
|
||||
public static byte max(byte a, byte b, byte c) => max(a, max(b, c));
|
||||
public static byte max(byte a, byte b, byte c, byte d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static int pow2(byte v) => v * v;
|
||||
public static int pow3(byte v) => v * v * v;
|
||||
public static int pow4(byte v) => v * v * v * v;
|
||||
public static int pow(byte v, int e) {
|
||||
int result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static float log10(byte v) => MathF.Log10(v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static float log2(byte v) => MathF.Log2(v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static float log(byte v) => MathF.Log(v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static float log(byte v, float b) => MathF.Log(v, b);
|
||||
|
||||
public static float sqrt(byte v) => MathF.Sqrt(v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static byte clamp(byte v, byte a, byte b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static byte lerp(byte a, byte b, float t) => (byte)(a * (1 - t) + b * t);
|
||||
|
||||
|
||||
public static unsafe byte bitCastInt(byte v) => *&v;
|
||||
public static unsafe byte bitCastInt(byte* v) => *v;
|
||||
|
||||
public static unsafe byte bitCastByteFromInt(byte v) => *&v;
|
||||
public static unsafe byte bitCastByteFromInt(byte* v) => *v;
|
||||
|
||||
public static unsafe T bitCast<T>(byte v) where T : unmanaged => *(T*)&v;
|
||||
public static unsafe T bitCast<T>(byte* v) where T : unmanaged => *(T*)v;
|
||||
|
||||
public static unsafe byte nextValue(byte v) => *(byte*)(v + 1);
|
||||
public static unsafe byte nextValue(byte* v) => *(byte*)(*v + 1);
|
||||
|
||||
public static unsafe byte previousValue(byte v) => *(byte*)(v - 1);
|
||||
public static unsafe byte previousValue(byte* v) => *(byte*)(*v - 1);
|
||||
|
||||
#endregion byteOps
|
||||
|
||||
// * region sbyteOps : math and other useful operations with sbyte
|
||||
#region sbyteOps
|
||||
|
||||
public static sbyte min(sbyte a, sbyte b) => a >= b ? b : a;
|
||||
public static sbyte min(sbyte a, sbyte b, sbyte c) => min(a, min(b, c));
|
||||
public static sbyte min(sbyte a, sbyte b, sbyte c, sbyte d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static sbyte max(sbyte a, sbyte b) => a >= b ? a : b;
|
||||
public static sbyte max(sbyte a, sbyte b, sbyte c) => max(a, max(b, c));
|
||||
public static sbyte max(sbyte a, sbyte b, sbyte c, sbyte d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static int pow2(sbyte v) => v * v;
|
||||
public static int pow3(sbyte v) => v * v * v;
|
||||
public static int pow4(sbyte v) => v * v * v * v;
|
||||
public static int pow(sbyte v, int e) {
|
||||
int result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static float log10(sbyte v) => MathF.Log10(v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static float log2(sbyte v) => MathF.Log2(v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static float log(sbyte v) => MathF.Log(v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static float log(sbyte v, float b) => MathF.Log(v, b);
|
||||
|
||||
public static float sqrt(sbyte v) => MathF.Sqrt(v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static sbyte clamp(sbyte v, sbyte a, sbyte b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static sbyte lerp(sbyte a, sbyte b, float t) => (sbyte)(a * (1 - t) + b * t);
|
||||
|
||||
public static sbyte abs(sbyte a) => (sbyte)(a < 0 ? -a : a);
|
||||
|
||||
|
||||
public static unsafe byte bitCastInt(sbyte v) => *(byte*)&v;
|
||||
public static unsafe byte bitCastInt(sbyte* v) => *(byte*)v;
|
||||
|
||||
public static unsafe sbyte bitCastSbyteFromInt(byte v) => *(sbyte*)&v;
|
||||
public static unsafe sbyte bitCastSbyteFromInt(byte* v) => *(sbyte*)v;
|
||||
|
||||
public static unsafe T bitCast<T>(sbyte v) where T : unmanaged => *(T*)&v;
|
||||
public static unsafe T bitCast<T>(sbyte* v) where T : unmanaged => *(T*)v;
|
||||
|
||||
public static unsafe sbyte nextValue(sbyte v) => *(sbyte*)(v + 1);
|
||||
public static unsafe sbyte nextValue(sbyte* v) => *(sbyte*)(*(byte*)v + 1);
|
||||
|
||||
public static unsafe sbyte previousValue(sbyte v) => *(sbyte*)(v - 1);
|
||||
public static unsafe sbyte previousValue(sbyte* v) => *(sbyte*)(*(byte*)v - 1);
|
||||
|
||||
#endregion sbyteOps
|
||||
|
||||
// * region shortOps : math and other useful operations with short
|
||||
#region shortOps
|
||||
|
||||
public static short min(short a, short b) => a >= b ? b : a;
|
||||
public static short min(short a, short b, short c) => min(a, min(b, c));
|
||||
public static short min(short a, short b, short c, short d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static short max(short a, short b) => a >= b ? a : b;
|
||||
public static short max(short a, short b, short c) => max(a, max(b, c));
|
||||
public static short max(short a, short b, short c, short d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static int pow2(short v) => v * v;
|
||||
public static int pow3(short v) => v * v * v;
|
||||
public static int pow4(short v) => v * v * v * v;
|
||||
public static int pow(short v, int e) {
|
||||
int result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static float log10(short v) => MathF.Log10(v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static float log2(short v) => MathF.Log2(v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static float log(short v) => MathF.Log(v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static float log(short v, float b) => MathF.Log(v, b);
|
||||
|
||||
public static float sqrt(short v) => MathF.Sqrt(v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static short clamp(short v, short a, short b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static short lerp(short a, short b, float t) => (short)(a * (1 - t) + b * t);
|
||||
|
||||
public static short abs(short a) => (short)(a < 0 ? -a : a);
|
||||
|
||||
|
||||
public static unsafe ushort bitCastInt(short v) => *(ushort*)&v;
|
||||
public static unsafe ushort bitCastInt(short* v) => *(ushort*)v;
|
||||
|
||||
public static unsafe short bitCastShortFromInt(ushort v) => *(short*)&v;
|
||||
public static unsafe short bitCastShortFromInt(ushort* v) => *(short*)v;
|
||||
|
||||
public static unsafe T bitCast<T>(short v) where T : unmanaged => *(T*)&v;
|
||||
public static unsafe T bitCast<T>(short* v) where T : unmanaged => *(T*)v;
|
||||
|
||||
public static unsafe short nextValue(short v) => *(short*)(v + 1);
|
||||
public static unsafe short nextValue(short* v) => *(short*)(*(ushort*)v + 1);
|
||||
|
||||
public static unsafe short previousValue(short v) => *(short*)(v - 1);
|
||||
public static unsafe short previousValue(short* v) => *(short*)(*(ushort*)v - 1);
|
||||
|
||||
#endregion shortOps
|
||||
|
||||
// * region ushortOps : math and other useful operations with ushort
|
||||
#region ushortOps
|
||||
|
||||
public static ushort min(ushort a, ushort b) => a >= b ? b : a;
|
||||
public static ushort min(ushort a, ushort b, ushort c) => min(a, min(b, c));
|
||||
public static ushort min(ushort a, ushort b, ushort c, ushort d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static ushort max(ushort a, ushort b) => a >= b ? a : b;
|
||||
public static ushort max(ushort a, ushort b, ushort c) => max(a, max(b, c));
|
||||
public static ushort max(ushort a, ushort b, ushort c, ushort d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static int pow2(ushort v) => v * v;
|
||||
public static int pow3(ushort v) => v * v * v;
|
||||
public static int pow4(ushort v) => v * v * v * v;
|
||||
public static int pow(ushort v, int e) {
|
||||
int result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static float log10(ushort v) => MathF.Log10(v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static float log2(ushort v) => MathF.Log2(v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static float log(ushort v) => MathF.Log(v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static float log(ushort v, float b) => MathF.Log(v, b);
|
||||
|
||||
public static float sqrt(ushort v) => MathF.Sqrt(v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static ushort clamp(ushort v, ushort a, ushort b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static ushort lerp(ushort a, ushort b, float t) => (ushort)(a * (1 - t) + b * t);
|
||||
|
||||
|
||||
public static unsafe ushort bitCastInt(ushort v) => *&v;
|
||||
public static unsafe ushort bitCastInt(ushort* v) => *v;
|
||||
|
||||
public static unsafe ushort bitCastUshortFromInt(ushort v) => *&v;
|
||||
public static unsafe ushort bitCastUshortFromInt(ushort* v) => *v;
|
||||
|
||||
public static unsafe T bitCast<T>(ushort v) where T : unmanaged => *(T*)&v;
|
||||
public static unsafe T bitCast<T>(ushort* v) where T : unmanaged => *(T*)v;
|
||||
|
||||
public static unsafe ushort nextValue(ushort v) => *(ushort*)(v + 1);
|
||||
public static unsafe ushort nextValue(ushort* v) => *(ushort*)(*v + 1);
|
||||
|
||||
public static unsafe ushort previousValue(ushort v) => *(ushort*)(v - 1);
|
||||
public static unsafe ushort previousValue(ushort* v) => *(ushort*)(*v - 1);
|
||||
|
||||
#endregion ushortOps
|
||||
|
||||
// * region intOps : math and other useful operations with int
|
||||
#region intOps
|
||||
|
||||
public static int min(int a, int b) => a >= b ? b : a;
|
||||
public static int min(int a, int b, int c) => min(a, min(b, c));
|
||||
public static int min(int a, int b, int c, int d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static int max(int a, int b) => a >= b ? a : b;
|
||||
public static int max(int a, int b, int c) => max(a, max(b, c));
|
||||
public static int max(int a, int b, int c, int d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static int pow2(int v) => v * v;
|
||||
public static int pow3(int v) => v * v * v;
|
||||
public static int pow4(int v) => v * v * v * v;
|
||||
public static int pow(int v, int e) {
|
||||
int result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static float log10(int v) => MathF.Log10(v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static float log2(int v) => MathF.Log2(v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static float log(int v) => MathF.Log(v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static float log(int v, float b) => MathF.Log(v, b);
|
||||
|
||||
public static float sqrt(int v) => MathF.Sqrt(v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static int clamp(int v, int a, int b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static int lerp(int a, int b, float t) => (int)(a * (1 - t) + b * t);
|
||||
|
||||
public static int abs(int a) => a < 0 ? -a : a;
|
||||
|
||||
|
||||
public static unsafe uint bitCastInt(int v) => *(uint*)&v;
|
||||
public static unsafe uint bitCastInt(int* v) => *(uint*)v;
|
||||
|
||||
public static unsafe int bitCastIntFromInt(uint v) => *(int*)&v;
|
||||
public static unsafe int bitCastIntFromInt(uint* v) => *(int*)v;
|
||||
|
||||
public static unsafe T bitCast<T>(int v) where T : unmanaged => *(T*)&v;
|
||||
public static unsafe T bitCast<T>(int* v) where T : unmanaged => *(T*)v;
|
||||
|
||||
public static unsafe int nextValue(int v) => *(int*)(v + 1);
|
||||
public static unsafe int nextValue(int* v) => *(int*)(*(uint*)v + 1);
|
||||
|
||||
public static unsafe int previousValue(int v) => *(int*)(v - 1);
|
||||
public static unsafe int previousValue(int* v) => *(int*)(*(uint*)v - 1);
|
||||
|
||||
#endregion intOps
|
||||
|
||||
// * region uintOps : math and other useful operations with uint
|
||||
#region uintOps
|
||||
|
||||
public static uint min(uint a, uint b) => a >= b ? b : a;
|
||||
public static uint min(uint a, uint b, uint c) => min(a, min(b, c));
|
||||
public static uint min(uint a, uint b, uint c, uint d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static uint max(uint a, uint b) => a >= b ? a : b;
|
||||
public static uint max(uint a, uint b, uint c) => max(a, max(b, c));
|
||||
public static uint max(uint a, uint b, uint c, uint d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static long pow2(uint v) => v * v;
|
||||
public static long pow3(uint v) => v * v * v;
|
||||
public static long pow4(uint v) => v * v * v * v;
|
||||
public static long pow(uint v, int e) {
|
||||
long result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static float log10(uint v) => MathF.Log10(v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static float log2(uint v) => MathF.Log2(v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static float log(uint v) => MathF.Log(v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static float log(uint v, float b) => MathF.Log(v, b);
|
||||
|
||||
public static float sqrt(uint v) => MathF.Sqrt(v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static uint clamp(uint v, uint a, uint b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static uint lerp(uint a, uint b, float t) => (uint)(a * (1 - t) + b * t);
|
||||
|
||||
|
||||
public static unsafe uint bitCastInt(uint v) => *&v;
|
||||
public static unsafe uint bitCastInt(uint* v) => *v;
|
||||
|
||||
public static unsafe uint bitCastUintFromInt(uint v) => *&v;
|
||||
public static unsafe uint bitCastUintFromInt(uint* v) => *v;
|
||||
|
||||
public static unsafe T bitCast<T>(uint v) where T : unmanaged => *(T*)&v;
|
||||
public static unsafe T bitCast<T>(uint* v) where T : unmanaged => *(T*)v;
|
||||
|
||||
public static unsafe uint nextValue(uint v) => *(uint*)(v + 1);
|
||||
public static unsafe uint nextValue(uint* v) => *(uint*)(*v + 1);
|
||||
|
||||
public static unsafe uint previousValue(uint v) => *(uint*)(v - 1);
|
||||
public static unsafe uint previousValue(uint* v) => *(uint*)(*v - 1);
|
||||
|
||||
#endregion uintOps
|
||||
|
||||
// * region longOps : math and other useful operations with long
|
||||
#region longOps
|
||||
|
||||
public static long min(long a, long b) => a >= b ? b : a;
|
||||
public static long min(long a, long b, long c) => min(a, min(b, c));
|
||||
public static long min(long a, long b, long c, long d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static long max(long a, long b) => a >= b ? a : b;
|
||||
public static long max(long a, long b, long c) => max(a, max(b, c));
|
||||
public static long max(long a, long b, long c, long d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static long pow2(long v) => v * v;
|
||||
public static long pow3(long v) => v * v * v;
|
||||
public static long pow4(long v) => v * v * v * v;
|
||||
public static long pow(long v, int e) {
|
||||
long result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static double log10(long v) => Math.Log10(v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static double log2(long v) => Math.Log2(v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static double log(long v) => Math.Log(v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static double log(long v, double b) => Math.Log(v, b);
|
||||
|
||||
public static double sqrt(long v) => Math.Sqrt(v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static long clamp(long v, long a, long b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static long lerp(long a, long b, double t) => (long)(a * (1 - t) + b * t);
|
||||
|
||||
public static long abs(long a) => a < 0 ? -a : a;
|
||||
|
||||
|
||||
public static unsafe ulong bitCastInt(long v) => *(ulong*)&v;
|
||||
public static unsafe ulong bitCastInt(long* v) => *(ulong*)v;
|
||||
|
||||
public static unsafe long bitCastLongFromInt(ulong v) => *(long*)&v;
|
||||
public static unsafe long bitCastLongFromInt(ulong* v) => *(long*)v;
|
||||
|
||||
public static unsafe T bitCast<T>(long v) where T : unmanaged => *(T*)&v;
|
||||
public static unsafe T bitCast<T>(long* v) where T : unmanaged => *(T*)v;
|
||||
|
||||
public static unsafe long nextValue(long v) => *(long*)(v + 1);
|
||||
public static unsafe long nextValue(long* v) => *(long*)(*(ulong*)v + 1);
|
||||
|
||||
public static unsafe long previousValue(long v) => *(long*)(v - 1);
|
||||
public static unsafe long previousValue(long* v) => *(long*)(*(ulong*)v - 1);
|
||||
|
||||
#endregion longOps
|
||||
|
||||
// * region ulongOps : math and other useful operations with ulong
|
||||
#region ulongOps
|
||||
|
||||
public static ulong min(ulong a, ulong b) => a >= b ? b : a;
|
||||
public static ulong min(ulong a, ulong b, ulong c) => min(a, min(b, c));
|
||||
public static ulong min(ulong a, ulong b, ulong c, ulong d) => min(min(a, b), min(c, d));
|
||||
|
||||
public static ulong max(ulong a, ulong b) => a >= b ? a : b;
|
||||
public static ulong max(ulong a, ulong b, ulong c) => max(a, max(b, c));
|
||||
public static ulong max(ulong a, ulong b, ulong c, ulong d) => max(max(a, b), max(c, d));
|
||||
|
||||
public static ulong pow2(ulong v) => v * v;
|
||||
public static ulong pow3(ulong v) => v * v * v;
|
||||
public static ulong pow4(ulong v) => v * v * v * v;
|
||||
public static ulong pow(ulong v, int e) {
|
||||
ulong result = 1;
|
||||
for (;;) {
|
||||
if ((e & 1) == 1) result *= v;
|
||||
e >>= 1;
|
||||
if (e == 0) break;
|
||||
v *= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>logarithm of base 10</summary>
|
||||
public static double log10(ulong v) => Math.Log10(v);
|
||||
///<summary>logarithm of base 2</summary>
|
||||
public static double log2(ulong v) => Math.Log2(v);
|
||||
///<summary>logarithm of base e (2.71828)</summary>
|
||||
public static double log(ulong v) => Math.Log(v);
|
||||
///<summary>logarithm of base 'b'</summary>
|
||||
public static double log(ulong v, double b) => Math.Log(v, b);
|
||||
|
||||
public static double sqrt(ulong v) => Math.Sqrt(v);
|
||||
|
||||
///<summary>clamps value 'v' between 'a' and 'b'</summary>
|
||||
public static ulong clamp(ulong v, ulong a, ulong b) => max(a, min(v, b));
|
||||
|
||||
///<summary>interpolate between 'a' and 'b' using value 't' (0 to 1)</summary>
|
||||
public static ulong lerp(ulong a, ulong b, double t) => (ulong)(a * (1 - t) + b * t);
|
||||
|
||||
|
||||
public static unsafe ulong bitCastInt(ulong v) => *&v;
|
||||
public static unsafe ulong bitCastInt(ulong* v) => *v;
|
||||
|
||||
public static unsafe ulong bitCastUlongFromInt(ulong v) => *&v;
|
||||
public static unsafe ulong bitCastUlongFromInt(ulong* v) => *v;
|
||||
|
||||
public static unsafe T bitCast<T>(ulong v) where T : unmanaged => *(T*)&v;
|
||||
public static unsafe T bitCast<T>(ulong* v) where T : unmanaged => *(T*)v;
|
||||
|
||||
public static unsafe ulong nextValue(ulong v) => *(ulong*)(v + 1);
|
||||
public static unsafe ulong nextValue(ulong* v) => *(ulong*)(*v + 1);
|
||||
|
||||
public static unsafe ulong previousValue(ulong v) => *(ulong*)(v - 1);
|
||||
public static unsafe ulong previousValue(ulong* v) => *(ulong*)(*v - 1);
|
||||
|
||||
#endregion ulongOps
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
using MathStuff;
|
||||
|
||||
namespace SomeChartsUi.utils.collections;
|
||||
|
||||
public class HashedList<T> : NativeList<T> where T : unmanaged {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using MathStuff;
|
||||
|
||||
namespace SomeChartsUi.utils.collections;
|
||||
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
using System.Numerics;
|
||||
|
||||
namespace SomeChartsUi.utils {
|
||||
public static partial class math {
|
||||
public static int round(float v) => (int)v;
|
||||
|
||||
// public static int min(int a, int b) => a <= b ? a : b;
|
||||
// public static int max(int a, int b) => a >= b ? a : b;
|
||||
// public static int clamp(int v, int min_, int max_) => min(max_, max(v, min_));
|
||||
//
|
||||
// public static uint min(uint a, uint b) => a <= b ? a : b;
|
||||
// public static uint max(uint a, uint b) => a >= b ? a : b;
|
||||
// public static uint clamp(uint v, uint min_, uint max_) => min(max_, max(v, min_));
|
||||
//
|
||||
// public static long min(long a, long b) => a <= b ? a : b;
|
||||
// public static long max(long a, long b) => a >= b ? a : b;
|
||||
// public static long clamp(long v, long min_, long max_) => min(max_, max(v, min_));
|
||||
//
|
||||
// public static ulong min(ulong a, ulong b) => a <= b ? a : b;
|
||||
// public static ulong max(ulong a, ulong b) => a >= b ? a : b;
|
||||
// public static ulong clamp(ulong v, ulong min_, ulong max_) => min(max_, max(v, min_));
|
||||
//
|
||||
// public static float min(float a, float b) => a <= b ? a : b;
|
||||
// public static float max(float a, float b) => a >= b ? a : b;
|
||||
// public static float clamp(float v, float min_, float max_) => min(max_, max(v, min_));
|
||||
//
|
||||
public static int minFast_i16(int a, int b) => b + ((a - b) & (a - b) >> 16);
|
||||
public static int maxFast_i16(int a, int b) => a - ((a - b) & (a - b) >> 16);
|
||||
public static int clampFast_i16(int v, int min_, int max_) => minFast_i16(max_, maxFast_i16(v, min_));
|
||||
|
||||
public static int absFast(int a) => (a + (a >> 31)) ^ (a >> 31);
|
||||
//public static float abs(float a) => MathF.Abs(a);
|
||||
|
||||
public static int Log10Floor(long v) => (int)Math.Floor(Math.Log10(v));
|
||||
public static int Log10Floor(int v) => (int)Math.Floor(Math.Log10(v));
|
||||
public static int DivLog(int v) => (int)(v / Math.Log(v));
|
||||
public static long DivLog(long v) => (long)(v / Math.Log(v));
|
||||
|
||||
public static BigInteger DivLog(BigInteger v) => v / new BigInteger(BigInteger.Log(v));
|
||||
|
||||
public static unsafe long ceilDiv(long a, long b) {
|
||||
bool check = a % b != 0;
|
||||
return a / b + *(byte*)✓
|
||||
}
|
||||
|
||||
public static unsafe void Sort_Tiny<T>(float* indexes, T* bindValues, int count) where T : unmanaged {
|
||||
for (int first = 1; first < count; first++) {
|
||||
float temp = indexes[first];
|
||||
T tempB = bindValues[first];
|
||||
int left = first - 1;
|
||||
while (left >= 0 && indexes[left] > temp) {
|
||||
indexes[left + 1] = indexes[left];
|
||||
bindValues[left + 1] = bindValues[left];
|
||||
left--;
|
||||
}
|
||||
|
||||
indexes[left + 1] = temp;
|
||||
bindValues[left + 1] = tempB;
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe void Sort_TinyU16<T>(T* values, int count, int indexOffset) where T : unmanaged {
|
||||
if ((sizeof(T) & 0b1) != 0) throw new InvalidDataException($"Sort_TinyU16 accept values with size of power of 2 ({typeof(T).Name})");
|
||||
|
||||
ushort* indexes = (ushort*)((byte*)values + indexOffset);
|
||||
int indexAdd = sizeof(T) >> 1;
|
||||
for (int first = 1; first < count; first++) {
|
||||
int temp = indexes[first * indexAdd];
|
||||
T tempB = values[first];
|
||||
int left = first - 1;
|
||||
while (left >= 0 && indexes[left * indexAdd] > temp) {
|
||||
values[left + 1] = values[left];
|
||||
left--;
|
||||
}
|
||||
|
||||
values[left + 1] = tempB;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static unsafe (float v, int ind) GetMinIndex(float* values, int count) {
|
||||
float minV = values[0];
|
||||
int minInd = 0;
|
||||
for (int i = 1; i < count; i++) {
|
||||
if (values[i] >= minV) continue;
|
||||
minV = values[i];
|
||||
minInd = i;
|
||||
}
|
||||
|
||||
return (minV, minInd);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
using System.Numerics;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.utils.collections;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.utils.mesh;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
|
||||
namespace SomeChartsUi.utils.mesh;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System.Runtime.InteropServices;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using MathStuff.vectors;
|
||||
|
||||
namespace SomeChartsUi.utils.mesh;
|
||||
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUi.utils.rects;
|
||||
|
||||
public struct rect {
|
||||
public float left;
|
||||
public float bottom;
|
||||
public float width;
|
||||
public float height;
|
||||
|
||||
public float right => left + width;
|
||||
public float top => bottom + height;
|
||||
|
||||
public float2 leftBottom => new(left, bottom);
|
||||
public float2 leftTop => new(left, top);
|
||||
public float2 rightTop => new(right, top);
|
||||
public float2 rightBottom => new(right, bottom);
|
||||
|
||||
public float2 widthHeight => new(width, height);
|
||||
|
||||
public float midX => left + width * .5f;
|
||||
public float midY => bottom + height * .5f;
|
||||
|
||||
public void InvertY() => (bottom, height) = (top, -height);
|
||||
|
||||
public float RightWithMul(float s) => left + width * s;
|
||||
public float TopWithMul(float s) => bottom + height * s;
|
||||
|
||||
public rect(float left, float bottom, float width, float height) {
|
||||
this.left = left;
|
||||
this.bottom = bottom;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public bool Contains(float2 p) => (p.x >= left) & (p.y >= bottom) & (p.x <= right) & (p.y <= top);
|
||||
public bool Contains(float x, float y) => (x >= left) & (y >= bottom) & (x <= right) & (y <= top);
|
||||
|
||||
public bool Contains(float x, float y, float w, float h) => (x + w >= left) & (y + h >= bottom) & (x - w <= right) & (y - h <= top);
|
||||
public bool ContainsY(float y, float h) => (y + h >= bottom) & (y - h <= top);
|
||||
|
||||
public bool Contains(rect r) => r.left <= right && r.right >= left && r.bottom <= top && r.top >= bottom;
|
||||
public bool Contains(rect r, float a) => r.left <= right + a && r.right + a >= left && r.bottom <= top + a && r.top + a >= bottom;
|
||||
|
||||
public bool Intersects(float2 p0, float2 p1) =>
|
||||
Contains(p0) & Contains(p1) ||
|
||||
_BottomIntersection(p0, p1) ||
|
||||
_TopIntersection(p0, p1) ||
|
||||
_LeftIntersection(p0, p1) ||
|
||||
_RightIntersection(p0, p1);
|
||||
|
||||
private bool _BottomIntersection(float2 p0, float2 p1) => LineLine(p0, p1, new(left, bottom), new(right, bottom));
|
||||
private bool _TopIntersection(float2 p0, float2 p1) => LineLine(p0, p1, new(left, top), new(right, top));
|
||||
private bool _LeftIntersection(float2 p0, float2 p1) => LineLine(p0, p1, new(left, bottom), new(left, top));
|
||||
private bool _RightIntersection(float2 p0, float2 p1) => LineLine(p0, p1, new(right, bottom), new(right, top));
|
||||
|
||||
private static bool LineLine(float2 a0, float2 a1, float2 b0, float2 b1) {
|
||||
float2 b = a1 - a0;
|
||||
float2 d = b1 - b0;
|
||||
float bDotDPerp = b.x * d.y - b.y * d.x;
|
||||
|
||||
if (bDotDPerp == 0) return false;
|
||||
bDotDPerp = 1 / bDotDPerp;
|
||||
|
||||
float2 c = b0 - a0;
|
||||
float t = (c.x * d.y - c.y * d.x) * bDotDPerp;
|
||||
if ((t < 0) | (t > 1)) return false;
|
||||
|
||||
float u = (c.x * b.y - c.y * b.x) * bDotDPerp;
|
||||
return (u > 0) & (u < 1);
|
||||
}
|
||||
|
||||
public void Deconstruct(out float x, out float y, out float w, out float h) {
|
||||
x = left;
|
||||
y = bottom;
|
||||
w = width;
|
||||
h = height;
|
||||
}
|
||||
|
||||
public rect ToWorld(float2 pos, float2 scale) => new(left - pos.x, bottom - pos.y, width / scale.x, height / scale.y);
|
||||
public rect ToScreen(float2 pos, float2 scale) => new((left + pos.x) * scale.x, (bottom + pos.y) * scale.y, width * scale.x, height * scale.y);
|
||||
|
||||
// public static implicit operator ChRect(Rect v) {
|
||||
// return new((float)v.Left, (float)v.Top, (float)v.Width, (float)v.Height);
|
||||
// }
|
||||
// public static implicit operator SKRect(ChRect v) {
|
||||
// return new(v.left, v.bottom, v.right, v.top);
|
||||
// }
|
||||
|
||||
public override string ToString() => $"({left},{bottom},{width},{height})";
|
||||
}
|
|
@ -1,943 +0,0 @@
|
|||
/* GENERATED USING T4 */
|
||||
|
||||
// ReSharper disable CompareOfFloatsByEqualityOperator
|
||||
// ReSharper disable IdentifierTypo
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
using SomeChartsUi.themes.colors;
|
||||
namespace SomeChartsUi.utils.vectors;
|
||||
|
||||
public struct float2 {
|
||||
#region staticFields
|
||||
|
||||
public static readonly float2 zero = new(0);
|
||||
public static readonly float2 one = new(1);
|
||||
public static readonly float2 maxValue = new(float.MaxValue);
|
||||
public static readonly float2 minValue = new(float.MinValue);
|
||||
public static readonly float2 up = new(0,1);
|
||||
public static readonly float2 down = new(0,-1);
|
||||
public static readonly float2 right = new(1,0);
|
||||
public static readonly float2 left = new(-1,0);
|
||||
|
||||
|
||||
#endregion staticFields
|
||||
|
||||
#region axis
|
||||
|
||||
// x axis
|
||||
public float x;
|
||||
public float2 xx => new(x,x);
|
||||
public float3 xxx => new(x,x,x);
|
||||
public float4 xxxx => new(x,x,x,x);
|
||||
public float4 xxxy => new(x,x,x,y);
|
||||
public float3 xxy => new(x,x,y);
|
||||
public float4 xxyx => new(x,x,y,x);
|
||||
public float4 xxyy => new(x,x,y,y);
|
||||
public float2 xy => new(x,y);
|
||||
public float3 xyx => new(x,y,x);
|
||||
public float4 xyxx => new(x,y,x,x);
|
||||
public float4 xyxy => new(x,y,x,y);
|
||||
public float3 xyy => new(x,y,y);
|
||||
public float4 xyyx => new(x,y,y,x);
|
||||
public float4 xyyy => new(x,y,y,y);
|
||||
// y axis
|
||||
public float y;
|
||||
public float2 yx => new(y,x);
|
||||
public float3 yxx => new(y,x,x);
|
||||
public float4 yxxx => new(y,x,x,x);
|
||||
public float4 yxxy => new(y,x,x,y);
|
||||
public float3 yxy => new(y,x,y);
|
||||
public float4 yxyx => new(y,x,y,x);
|
||||
public float4 yxyy => new(y,x,y,y);
|
||||
public float2 yy => new(y,y);
|
||||
public float3 yyx => new(y,y,x);
|
||||
public float4 yyxx => new(y,y,x,x);
|
||||
public float4 yyxy => new(y,y,x,y);
|
||||
public float3 yyy => new(y,y,y);
|
||||
public float4 yyyx => new(y,y,y,x);
|
||||
public float4 yyyy => new(y,y,y,y);
|
||||
|
||||
#endregion axis
|
||||
|
||||
#region constructors
|
||||
|
||||
public float2(float x = 0, float y = 0) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
public float2(float v) : this(v, v) {}
|
||||
|
||||
#endregion constructors
|
||||
|
||||
#region functions
|
||||
|
||||
public float lengthSq => x*x + y*y;
|
||||
public float length => math.sqrt(lengthSq);
|
||||
|
||||
public float sum => x + y;
|
||||
public float mul => x * y;
|
||||
public float avg => sum * 0.5f;
|
||||
public float min => math.min(x, y);
|
||||
public float max => math.max(x, y);
|
||||
|
||||
public float2 normalized { get { float len = 1 / length; return this * len; } }
|
||||
|
||||
public float2 WithLength(float l) { float len = l / length; return this * len; }
|
||||
|
||||
public void FlipX() => x = -x;
|
||||
public void FlipY() => y = -y;
|
||||
|
||||
#endregion functions
|
||||
|
||||
#region operators
|
||||
|
||||
// binary operator '+'
|
||||
public static float2 operator +(float2 a, float2 b) => new(a.x + b.x, a.y + b.y);
|
||||
public static float2 operator +(float a, float2 b) => new(a + b.x, a + b.y);
|
||||
public static float2 operator +(float2 a, float b) => new(a.x + b, a.y + b);
|
||||
// binary operator '-'
|
||||
public static float2 operator -(float2 a, float2 b) => new(a.x - b.x, a.y - b.y);
|
||||
public static float2 operator -(float a, float2 b) => new(a - b.x, a - b.y);
|
||||
public static float2 operator -(float2 a, float b) => new(a.x - b, a.y - b);
|
||||
// binary operator '*'
|
||||
public static float2 operator *(float2 a, float2 b) => new(a.x * b.x, a.y * b.y);
|
||||
public static float2 operator *(float a, float2 b) => new(a * b.x, a * b.y);
|
||||
public static float2 operator *(float2 a, float b) => new(a.x * b, a.y * b);
|
||||
// binary operator '/'
|
||||
public static float2 operator /(float2 a, float2 b) => new(a.x / b.x, a.y / b.y);
|
||||
public static float2 operator /(float a, float2 b) => new(a / b.x, a / b.y);
|
||||
public static float2 operator /(float2 a, float b) => new(a.x / b, a.y / b);
|
||||
// equality operator '=='
|
||||
public static bool operator ==(float2 a, float2 b) => a.x == b.x && a.y == b.y;
|
||||
public static bool operator ==(float a, float2 b) => a == b.x && a == b.y;
|
||||
public static bool operator ==(float2 a, float b) => a.x == b && a.y == b;
|
||||
// equality operator '!='
|
||||
public static bool operator !=(float2 a, float2 b) => a.x != b.x || a.y != b.y;
|
||||
public static bool operator !=(float a, float2 b) => a != b.x || a != b.y;
|
||||
public static bool operator !=(float2 a, float b) => a.x != b || a.y != b;
|
||||
// equality operator '>'
|
||||
public static bool operator >(float2 a, float2 b) => a.x > b.x && a.y > b.y;
|
||||
public static bool operator >(float a, float2 b) => a > b.x && a > b.y;
|
||||
public static bool operator >(float2 a, float b) => a.x > b && a.y > b;
|
||||
// equality operator '>='
|
||||
public static bool operator >=(float2 a, float2 b) => a.x >= b.x && a.y >= b.y;
|
||||
public static bool operator >=(float a, float2 b) => a >= b.x && a >= b.y;
|
||||
public static bool operator >=(float2 a, float b) => a.x >= b && a.y >= b;
|
||||
// equality operator '<'
|
||||
public static bool operator <(float2 a, float2 b) => a.x < b.x && a.y < b.y;
|
||||
public static bool operator <(float a, float2 b) => a < b.x && a < b.y;
|
||||
public static bool operator <(float2 a, float b) => a.x < b && a.y < b;
|
||||
// equality operator '<='
|
||||
public static bool operator <=(float2 a, float2 b) => a.x <= b.x && a.y <= b.y;
|
||||
public static bool operator <=(float a, float2 b) => a <= b.x && a <= b.y;
|
||||
public static bool operator <=(float2 a, float b) => a.x <= b && a.y <= b;
|
||||
// other operators
|
||||
public static float2 operator -(float2 a) => new(-a.x, -a.y);
|
||||
public static implicit operator float2(float v) => new(v);
|
||||
public static implicit operator float2(int v) => new(v);
|
||||
|
||||
|
||||
#endregion operators
|
||||
|
||||
#region staticFunc
|
||||
|
||||
public static float2 Min(float2 a, float2 b) => new(math.min(a.x, b.x), math.min(a.y, b.y));
|
||||
public static float2 Min(float2 a, float2 b, float2 c) => new(math.min(a.x, b.x, c.x), math.min(a.y, b.y, c.y));
|
||||
public static float2 Min(float2 a, float2 b, float2 c, float2 d) => new(math.min(a.x, b.x, c.x, d.x), math.min(a.y, b.y, c.y, d.y));
|
||||
|
||||
public static float2 Max(float2 a, float2 b) => new(math.max(a.x, b.x), math.max(a.y, b.y));
|
||||
public static float2 Max(float2 a, float2 b, float2 c) => new(math.max(a.x, b.x, c.x), math.max(a.y, b.y, c.y));
|
||||
public static float2 Max(float2 a, float2 b, float2 c, float2 d) => new(math.max(a.x, b.x, c.x, d.x), math.max(a.y, b.y, c.y, d.y));
|
||||
|
||||
public static float2 Clamp(float2 v, float2 min, float2 max) => Max(Min(v, max), min);
|
||||
|
||||
#endregion staticFunc
|
||||
|
||||
#region impl
|
||||
|
||||
public bool Equals(float2 other) => x == other.x && y == other.y;
|
||||
public override bool Equals(object? obj) => obj is float2 other && Equals(other);
|
||||
public override int GetHashCode() => HashCode.Combine(x, y);
|
||||
|
||||
public override string ToString() => $"({x},{y})";
|
||||
|
||||
#endregion impl
|
||||
|
||||
#region other
|
||||
|
||||
public static float2 SinCos(float radians, float length) => new(MathF.Sin(radians) * length, MathF.Cos(radians) * length);
|
||||
public static float Dot(float2 a, float2 b) => a.x * b.x + a.y * b.y;
|
||||
|
||||
#endregion other
|
||||
}
|
||||
public struct float3 {
|
||||
#region staticFields
|
||||
|
||||
public static readonly float3 zero = new(0);
|
||||
public static readonly float3 one = new(1);
|
||||
public static readonly float3 maxValue = new(float.MaxValue);
|
||||
public static readonly float3 minValue = new(float.MinValue);
|
||||
public static readonly float3 up = new(0,1);
|
||||
public static readonly float3 down = new(0,-1);
|
||||
public static readonly float3 right = new(1,0);
|
||||
public static readonly float3 left = new(-1,0);
|
||||
|
||||
public static readonly float3 front = new(0,0,1);
|
||||
public static readonly float3 back = new(0,0,-1);
|
||||
|
||||
#endregion staticFields
|
||||
|
||||
#region axis
|
||||
|
||||
// x axis
|
||||
public float x;
|
||||
public float2 xx => new(x,x);
|
||||
public float3 xxx => new(x,x,x);
|
||||
public float4 xxxx => new(x,x,x,x);
|
||||
public float4 xxxy => new(x,x,x,y);
|
||||
public float4 xxxz => new(x,x,x,z);
|
||||
public float3 xxy => new(x,x,y);
|
||||
public float4 xxyx => new(x,x,y,x);
|
||||
public float4 xxyy => new(x,x,y,y);
|
||||
public float4 xxyz => new(x,x,y,z);
|
||||
public float3 xxz => new(x,x,z);
|
||||
public float4 xxzx => new(x,x,z,x);
|
||||
public float4 xxzy => new(x,x,z,y);
|
||||
public float4 xxzz => new(x,x,z,z);
|
||||
public float2 xy => new(x,y);
|
||||
public float3 xyx => new(x,y,x);
|
||||
public float4 xyxx => new(x,y,x,x);
|
||||
public float4 xyxy => new(x,y,x,y);
|
||||
public float4 xyxz => new(x,y,x,z);
|
||||
public float3 xyy => new(x,y,y);
|
||||
public float4 xyyx => new(x,y,y,x);
|
||||
public float4 xyyy => new(x,y,y,y);
|
||||
public float4 xyyz => new(x,y,y,z);
|
||||
public float3 xyz => new(x,y,z);
|
||||
public float4 xyzx => new(x,y,z,x);
|
||||
public float4 xyzy => new(x,y,z,y);
|
||||
public float4 xyzz => new(x,y,z,z);
|
||||
public float2 xz => new(x,z);
|
||||
public float3 xzx => new(x,z,x);
|
||||
public float4 xzxx => new(x,z,x,x);
|
||||
public float4 xzxy => new(x,z,x,y);
|
||||
public float4 xzxz => new(x,z,x,z);
|
||||
public float3 xzy => new(x,z,y);
|
||||
public float4 xzyx => new(x,z,y,x);
|
||||
public float4 xzyy => new(x,z,y,y);
|
||||
public float4 xzyz => new(x,z,y,z);
|
||||
public float3 xzz => new(x,z,z);
|
||||
public float4 xzzx => new(x,z,z,x);
|
||||
public float4 xzzy => new(x,z,z,y);
|
||||
public float4 xzzz => new(x,z,z,z);
|
||||
// y axis
|
||||
public float y;
|
||||
public float2 yx => new(y,x);
|
||||
public float3 yxx => new(y,x,x);
|
||||
public float4 yxxx => new(y,x,x,x);
|
||||
public float4 yxxy => new(y,x,x,y);
|
||||
public float4 yxxz => new(y,x,x,z);
|
||||
public float3 yxy => new(y,x,y);
|
||||
public float4 yxyx => new(y,x,y,x);
|
||||
public float4 yxyy => new(y,x,y,y);
|
||||
public float4 yxyz => new(y,x,y,z);
|
||||
public float3 yxz => new(y,x,z);
|
||||
public float4 yxzx => new(y,x,z,x);
|
||||
public float4 yxzy => new(y,x,z,y);
|
||||
public float4 yxzz => new(y,x,z,z);
|
||||
public float2 yy => new(y,y);
|
||||
public float3 yyx => new(y,y,x);
|
||||
public float4 yyxx => new(y,y,x,x);
|
||||
public float4 yyxy => new(y,y,x,y);
|
||||
public float4 yyxz => new(y,y,x,z);
|
||||
public float3 yyy => new(y,y,y);
|
||||
public float4 yyyx => new(y,y,y,x);
|
||||
public float4 yyyy => new(y,y,y,y);
|
||||
public float4 yyyz => new(y,y,y,z);
|
||||
public float3 yyz => new(y,y,z);
|
||||
public float4 yyzx => new(y,y,z,x);
|
||||
public float4 yyzy => new(y,y,z,y);
|
||||
public float4 yyzz => new(y,y,z,z);
|
||||
public float2 yz => new(y,z);
|
||||
public float3 yzx => new(y,z,x);
|
||||
public float4 yzxx => new(y,z,x,x);
|
||||
public float4 yzxy => new(y,z,x,y);
|
||||
public float4 yzxz => new(y,z,x,z);
|
||||
public float3 yzy => new(y,z,y);
|
||||
public float4 yzyx => new(y,z,y,x);
|
||||
public float4 yzyy => new(y,z,y,y);
|
||||
public float4 yzyz => new(y,z,y,z);
|
||||
public float3 yzz => new(y,z,z);
|
||||
public float4 yzzx => new(y,z,z,x);
|
||||
public float4 yzzy => new(y,z,z,y);
|
||||
public float4 yzzz => new(y,z,z,z);
|
||||
// z axis
|
||||
public float z;
|
||||
public float2 zx => new(z,x);
|
||||
public float3 zxx => new(z,x,x);
|
||||
public float4 zxxx => new(z,x,x,x);
|
||||
public float4 zxxy => new(z,x,x,y);
|
||||
public float4 zxxz => new(z,x,x,z);
|
||||
public float3 zxy => new(z,x,y);
|
||||
public float4 zxyx => new(z,x,y,x);
|
||||
public float4 zxyy => new(z,x,y,y);
|
||||
public float4 zxyz => new(z,x,y,z);
|
||||
public float3 zxz => new(z,x,z);
|
||||
public float4 zxzx => new(z,x,z,x);
|
||||
public float4 zxzy => new(z,x,z,y);
|
||||
public float4 zxzz => new(z,x,z,z);
|
||||
public float2 zy => new(z,y);
|
||||
public float3 zyx => new(z,y,x);
|
||||
public float4 zyxx => new(z,y,x,x);
|
||||
public float4 zyxy => new(z,y,x,y);
|
||||
public float4 zyxz => new(z,y,x,z);
|
||||
public float3 zyy => new(z,y,y);
|
||||
public float4 zyyx => new(z,y,y,x);
|
||||
public float4 zyyy => new(z,y,y,y);
|
||||
public float4 zyyz => new(z,y,y,z);
|
||||
public float3 zyz => new(z,y,z);
|
||||
public float4 zyzx => new(z,y,z,x);
|
||||
public float4 zyzy => new(z,y,z,y);
|
||||
public float4 zyzz => new(z,y,z,z);
|
||||
public float2 zz => new(z,z);
|
||||
public float3 zzx => new(z,z,x);
|
||||
public float4 zzxx => new(z,z,x,x);
|
||||
public float4 zzxy => new(z,z,x,y);
|
||||
public float4 zzxz => new(z,z,x,z);
|
||||
public float3 zzy => new(z,z,y);
|
||||
public float4 zzyx => new(z,z,y,x);
|
||||
public float4 zzyy => new(z,z,y,y);
|
||||
public float4 zzyz => new(z,z,y,z);
|
||||
public float3 zzz => new(z,z,z);
|
||||
public float4 zzzx => new(z,z,z,x);
|
||||
public float4 zzzy => new(z,z,z,y);
|
||||
public float4 zzzz => new(z,z,z,z);
|
||||
|
||||
#endregion axis
|
||||
|
||||
#region constructors
|
||||
|
||||
public float3(float x = 0, float y = 0, float z = 0) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
public float3(float v) : this(v, v, v) {}
|
||||
|
||||
#endregion constructors
|
||||
|
||||
#region functions
|
||||
|
||||
public float lengthSq => x*x + y*y + z*z;
|
||||
public float length => math.sqrt(lengthSq);
|
||||
|
||||
public float sum => x + y + z;
|
||||
public float mul => x * y * z;
|
||||
public float avg => sum * 0.3333333f;
|
||||
public float min => math.min(x, y, z);
|
||||
public float max => math.max(x, y, z);
|
||||
|
||||
public float3 normalized { get { float len = 1 / length; return this * len; } }
|
||||
|
||||
public float3 WithLength(float l) { float len = l / length; return this * len; }
|
||||
|
||||
public void FlipX() => x = -x;
|
||||
public void FlipY() => y = -y;
|
||||
public void FlipZ() => z = -z;
|
||||
|
||||
#endregion functions
|
||||
|
||||
#region operators
|
||||
|
||||
// binary operator '+'
|
||||
public static float3 operator +(float3 a, float3 b) => new(a.x + b.x, a.y + b.y, a.z + b.z);
|
||||
public static float3 operator +(float a, float3 b) => new(a + b.x, a + b.y, a + b.z);
|
||||
public static float3 operator +(float3 a, float b) => new(a.x + b, a.y + b, a.z + b);
|
||||
// binary operator '-'
|
||||
public static float3 operator -(float3 a, float3 b) => new(a.x - b.x, a.y - b.y, a.z - b.z);
|
||||
public static float3 operator -(float a, float3 b) => new(a - b.x, a - b.y, a - b.z);
|
||||
public static float3 operator -(float3 a, float b) => new(a.x - b, a.y - b, a.z - b);
|
||||
// binary operator '*'
|
||||
public static float3 operator *(float3 a, float3 b) => new(a.x * b.x, a.y * b.y, a.z * b.z);
|
||||
public static float3 operator *(float a, float3 b) => new(a * b.x, a * b.y, a * b.z);
|
||||
public static float3 operator *(float3 a, float b) => new(a.x * b, a.y * b, a.z * b);
|
||||
// binary operator '/'
|
||||
public static float3 operator /(float3 a, float3 b) => new(a.x / b.x, a.y / b.y, a.z / b.z);
|
||||
public static float3 operator /(float a, float3 b) => new(a / b.x, a / b.y, a / b.z);
|
||||
public static float3 operator /(float3 a, float b) => new(a.x / b, a.y / b, a.z / b);
|
||||
// equality operator '=='
|
||||
public static bool operator ==(float3 a, float3 b) => a.x == b.x && a.y == b.y && a.z == b.z;
|
||||
public static bool operator ==(float a, float3 b) => a == b.x && a == b.y && a == b.z;
|
||||
public static bool operator ==(float3 a, float b) => a.x == b && a.y == b && a.z == b;
|
||||
// equality operator '!='
|
||||
public static bool operator !=(float3 a, float3 b) => a.x != b.x || a.y != b.y || a.z != b.z;
|
||||
public static bool operator !=(float a, float3 b) => a != b.x || a != b.y || a != b.z;
|
||||
public static bool operator !=(float3 a, float b) => a.x != b || a.y != b || a.z != b;
|
||||
// equality operator '>'
|
||||
public static bool operator >(float3 a, float3 b) => a.x > b.x && a.y > b.y && a.z > b.z;
|
||||
public static bool operator >(float a, float3 b) => a > b.x && a > b.y && a > b.z;
|
||||
public static bool operator >(float3 a, float b) => a.x > b && a.y > b && a.z > b;
|
||||
// equality operator '>='
|
||||
public static bool operator >=(float3 a, float3 b) => a.x >= b.x && a.y >= b.y && a.z >= b.z;
|
||||
public static bool operator >=(float a, float3 b) => a >= b.x && a >= b.y && a >= b.z;
|
||||
public static bool operator >=(float3 a, float b) => a.x >= b && a.y >= b && a.z >= b;
|
||||
// equality operator '<'
|
||||
public static bool operator <(float3 a, float3 b) => a.x < b.x && a.y < b.y && a.z < b.z;
|
||||
public static bool operator <(float a, float3 b) => a < b.x && a < b.y && a < b.z;
|
||||
public static bool operator <(float3 a, float b) => a.x < b && a.y < b && a.z < b;
|
||||
// equality operator '<='
|
||||
public static bool operator <=(float3 a, float3 b) => a.x <= b.x && a.y <= b.y && a.z <= b.z;
|
||||
public static bool operator <=(float a, float3 b) => a <= b.x && a <= b.y && a <= b.z;
|
||||
public static bool operator <=(float3 a, float b) => a.x <= b && a.y <= b && a.z <= b;
|
||||
// other operators
|
||||
public static float3 operator -(float3 a) => new(-a.x, -a.y, -a.z);
|
||||
public static implicit operator float3(float v) => new(v);
|
||||
public static implicit operator float3(int v) => new(v);
|
||||
|
||||
public float3(float2 a, float z) {
|
||||
x = a.x;
|
||||
y = a.y;
|
||||
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public static implicit operator float2(float3 v) => v.xy;
|
||||
public static implicit operator float3(float2 v) => new(v.x, v.y, 0);
|
||||
|
||||
#endregion operators
|
||||
|
||||
#region staticFunc
|
||||
|
||||
public static float3 Min(float3 a, float3 b) => new(math.min(a.x, b.x), math.min(a.y, b.y), math.min(a.z, b.z));
|
||||
public static float3 Min(float3 a, float3 b, float3 c) => new(math.min(a.x, b.x, c.x), math.min(a.y, b.y, c.y), math.min(a.z, b.z, c.z));
|
||||
public static float3 Min(float3 a, float3 b, float3 c, float3 d) => new(math.min(a.x, b.x, c.x, d.x), math.min(a.y, b.y, c.y, d.y), math.min(a.z, b.z, c.z, d.z));
|
||||
|
||||
public static float3 Max(float3 a, float3 b) => new(math.max(a.x, b.x), math.max(a.y, b.y), math.max(a.z, b.z));
|
||||
public static float3 Max(float3 a, float3 b, float3 c) => new(math.max(a.x, b.x, c.x), math.max(a.y, b.y, c.y), math.max(a.z, b.z, c.z));
|
||||
public static float3 Max(float3 a, float3 b, float3 c, float3 d) => new(math.max(a.x, b.x, c.x, d.x), math.max(a.y, b.y, c.y, d.y), math.max(a.z, b.z, c.z, d.z));
|
||||
|
||||
public static float3 Clamp(float3 v, float3 min, float3 max) => Max(Min(v, max), min);
|
||||
|
||||
#endregion staticFunc
|
||||
|
||||
#region impl
|
||||
|
||||
public bool Equals(float3 other) => x == other.x && y == other.y && z == other.z;
|
||||
public override bool Equals(object? obj) => obj is float3 other && Equals(other);
|
||||
public override int GetHashCode() => HashCode.Combine(x, y, z);
|
||||
|
||||
public override string ToString() => $"({x},{y},{z})";
|
||||
|
||||
#endregion impl
|
||||
|
||||
#region other
|
||||
|
||||
public static implicit operator float3(color v) => new(v.rF, v.gF, v.bF);
|
||||
public static implicit operator color(float3 v) => new(v.x, v.y, v.z);
|
||||
|
||||
public static float3 Cross(float3 a, float3 b) => new(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
|
||||
public static float Dot(float3 a, float3 b) => a.x * b.x + a.y * b.y + a.z * b.z;
|
||||
|
||||
#endregion other
|
||||
}
|
||||
public struct float4 {
|
||||
#region staticFields
|
||||
|
||||
public static readonly float4 zero = new(0);
|
||||
public static readonly float4 one = new(1);
|
||||
public static readonly float4 maxValue = new(float.MaxValue);
|
||||
public static readonly float4 minValue = new(float.MinValue);
|
||||
public static readonly float4 up = new(0,1);
|
||||
public static readonly float4 down = new(0,-1);
|
||||
public static readonly float4 right = new(1,0);
|
||||
public static readonly float4 left = new(-1,0);
|
||||
|
||||
public static readonly float4 front = new(0,0,1);
|
||||
public static readonly float4 back = new(0,0,-1);
|
||||
|
||||
#endregion staticFields
|
||||
|
||||
#region axis
|
||||
|
||||
// x axis
|
||||
public float x;
|
||||
public float2 xx => new(x,x);
|
||||
public float3 xxx => new(x,x,x);
|
||||
public float4 xxxx => new(x,x,x,x);
|
||||
public float4 xxxy => new(x,x,x,y);
|
||||
public float4 xxxz => new(x,x,x,z);
|
||||
public float4 xxxw => new(x,x,x,w);
|
||||
public float3 xxy => new(x,x,y);
|
||||
public float4 xxyx => new(x,x,y,x);
|
||||
public float4 xxyy => new(x,x,y,y);
|
||||
public float4 xxyz => new(x,x,y,z);
|
||||
public float4 xxyw => new(x,x,y,w);
|
||||
public float3 xxz => new(x,x,z);
|
||||
public float4 xxzx => new(x,x,z,x);
|
||||
public float4 xxzy => new(x,x,z,y);
|
||||
public float4 xxzz => new(x,x,z,z);
|
||||
public float4 xxzw => new(x,x,z,w);
|
||||
public float3 xxw => new(x,x,w);
|
||||
public float4 xxwx => new(x,x,w,x);
|
||||
public float4 xxwy => new(x,x,w,y);
|
||||
public float4 xxwz => new(x,x,w,z);
|
||||
public float4 xxww => new(x,x,w,w);
|
||||
public float2 xy => new(x,y);
|
||||
public float3 xyx => new(x,y,x);
|
||||
public float4 xyxx => new(x,y,x,x);
|
||||
public float4 xyxy => new(x,y,x,y);
|
||||
public float4 xyxz => new(x,y,x,z);
|
||||
public float4 xyxw => new(x,y,x,w);
|
||||
public float3 xyy => new(x,y,y);
|
||||
public float4 xyyx => new(x,y,y,x);
|
||||
public float4 xyyy => new(x,y,y,y);
|
||||
public float4 xyyz => new(x,y,y,z);
|
||||
public float4 xyyw => new(x,y,y,w);
|
||||
public float3 xyz => new(x,y,z);
|
||||
public float4 xyzx => new(x,y,z,x);
|
||||
public float4 xyzy => new(x,y,z,y);
|
||||
public float4 xyzz => new(x,y,z,z);
|
||||
public float4 xyzw => new(x,y,z,w);
|
||||
public float3 xyw => new(x,y,w);
|
||||
public float4 xywx => new(x,y,w,x);
|
||||
public float4 xywy => new(x,y,w,y);
|
||||
public float4 xywz => new(x,y,w,z);
|
||||
public float4 xyww => new(x,y,w,w);
|
||||
public float2 xz => new(x,z);
|
||||
public float3 xzx => new(x,z,x);
|
||||
public float4 xzxx => new(x,z,x,x);
|
||||
public float4 xzxy => new(x,z,x,y);
|
||||
public float4 xzxz => new(x,z,x,z);
|
||||
public float4 xzxw => new(x,z,x,w);
|
||||
public float3 xzy => new(x,z,y);
|
||||
public float4 xzyx => new(x,z,y,x);
|
||||
public float4 xzyy => new(x,z,y,y);
|
||||
public float4 xzyz => new(x,z,y,z);
|
||||
public float4 xzyw => new(x,z,y,w);
|
||||
public float3 xzz => new(x,z,z);
|
||||
public float4 xzzx => new(x,z,z,x);
|
||||
public float4 xzzy => new(x,z,z,y);
|
||||
public float4 xzzz => new(x,z,z,z);
|
||||
public float4 xzzw => new(x,z,z,w);
|
||||
public float3 xzw => new(x,z,w);
|
||||
public float4 xzwx => new(x,z,w,x);
|
||||
public float4 xzwy => new(x,z,w,y);
|
||||
public float4 xzwz => new(x,z,w,z);
|
||||
public float4 xzww => new(x,z,w,w);
|
||||
public float2 xw => new(x,w);
|
||||
public float3 xwx => new(x,w,x);
|
||||
public float4 xwxx => new(x,w,x,x);
|
||||
public float4 xwxy => new(x,w,x,y);
|
||||
public float4 xwxz => new(x,w,x,z);
|
||||
public float4 xwxw => new(x,w,x,w);
|
||||
public float3 xwy => new(x,w,y);
|
||||
public float4 xwyx => new(x,w,y,x);
|
||||
public float4 xwyy => new(x,w,y,y);
|
||||
public float4 xwyz => new(x,w,y,z);
|
||||
public float4 xwyw => new(x,w,y,w);
|
||||
public float3 xwz => new(x,w,z);
|
||||
public float4 xwzx => new(x,w,z,x);
|
||||
public float4 xwzy => new(x,w,z,y);
|
||||
public float4 xwzz => new(x,w,z,z);
|
||||
public float4 xwzw => new(x,w,z,w);
|
||||
public float3 xww => new(x,w,w);
|
||||
public float4 xwwx => new(x,w,w,x);
|
||||
public float4 xwwy => new(x,w,w,y);
|
||||
public float4 xwwz => new(x,w,w,z);
|
||||
public float4 xwww => new(x,w,w,w);
|
||||
// y axis
|
||||
public float y;
|
||||
public float2 yx => new(y,x);
|
||||
public float3 yxx => new(y,x,x);
|
||||
public float4 yxxx => new(y,x,x,x);
|
||||
public float4 yxxy => new(y,x,x,y);
|
||||
public float4 yxxz => new(y,x,x,z);
|
||||
public float4 yxxw => new(y,x,x,w);
|
||||
public float3 yxy => new(y,x,y);
|
||||
public float4 yxyx => new(y,x,y,x);
|
||||
public float4 yxyy => new(y,x,y,y);
|
||||
public float4 yxyz => new(y,x,y,z);
|
||||
public float4 yxyw => new(y,x,y,w);
|
||||
public float3 yxz => new(y,x,z);
|
||||
public float4 yxzx => new(y,x,z,x);
|
||||
public float4 yxzy => new(y,x,z,y);
|
||||
public float4 yxzz => new(y,x,z,z);
|
||||
public float4 yxzw => new(y,x,z,w);
|
||||
public float3 yxw => new(y,x,w);
|
||||
public float4 yxwx => new(y,x,w,x);
|
||||
public float4 yxwy => new(y,x,w,y);
|
||||
public float4 yxwz => new(y,x,w,z);
|
||||
public float4 yxww => new(y,x,w,w);
|
||||
public float2 yy => new(y,y);
|
||||
public float3 yyx => new(y,y,x);
|
||||
public float4 yyxx => new(y,y,x,x);
|
||||
public float4 yyxy => new(y,y,x,y);
|
||||
public float4 yyxz => new(y,y,x,z);
|
||||
public float4 yyxw => new(y,y,x,w);
|
||||
public float3 yyy => new(y,y,y);
|
||||
public float4 yyyx => new(y,y,y,x);
|
||||
public float4 yyyy => new(y,y,y,y);
|
||||
public float4 yyyz => new(y,y,y,z);
|
||||
public float4 yyyw => new(y,y,y,w);
|
||||
public float3 yyz => new(y,y,z);
|
||||
public float4 yyzx => new(y,y,z,x);
|
||||
public float4 yyzy => new(y,y,z,y);
|
||||
public float4 yyzz => new(y,y,z,z);
|
||||
public float4 yyzw => new(y,y,z,w);
|
||||
public float3 yyw => new(y,y,w);
|
||||
public float4 yywx => new(y,y,w,x);
|
||||
public float4 yywy => new(y,y,w,y);
|
||||
public float4 yywz => new(y,y,w,z);
|
||||
public float4 yyww => new(y,y,w,w);
|
||||
public float2 yz => new(y,z);
|
||||
public float3 yzx => new(y,z,x);
|
||||
public float4 yzxx => new(y,z,x,x);
|
||||
public float4 yzxy => new(y,z,x,y);
|
||||
public float4 yzxz => new(y,z,x,z);
|
||||
public float4 yzxw => new(y,z,x,w);
|
||||
public float3 yzy => new(y,z,y);
|
||||
public float4 yzyx => new(y,z,y,x);
|
||||
public float4 yzyy => new(y,z,y,y);
|
||||
public float4 yzyz => new(y,z,y,z);
|
||||
public float4 yzyw => new(y,z,y,w);
|
||||
public float3 yzz => new(y,z,z);
|
||||
public float4 yzzx => new(y,z,z,x);
|
||||
public float4 yzzy => new(y,z,z,y);
|
||||
public float4 yzzz => new(y,z,z,z);
|
||||
public float4 yzzw => new(y,z,z,w);
|
||||
public float3 yzw => new(y,z,w);
|
||||
public float4 yzwx => new(y,z,w,x);
|
||||
public float4 yzwy => new(y,z,w,y);
|
||||
public float4 yzwz => new(y,z,w,z);
|
||||
public float4 yzww => new(y,z,w,w);
|
||||
public float2 yw => new(y,w);
|
||||
public float3 ywx => new(y,w,x);
|
||||
public float4 ywxx => new(y,w,x,x);
|
||||
public float4 ywxy => new(y,w,x,y);
|
||||
public float4 ywxz => new(y,w,x,z);
|
||||
public float4 ywxw => new(y,w,x,w);
|
||||
public float3 ywy => new(y,w,y);
|
||||
public float4 ywyx => new(y,w,y,x);
|
||||
public float4 ywyy => new(y,w,y,y);
|
||||
public float4 ywyz => new(y,w,y,z);
|
||||
public float4 ywyw => new(y,w,y,w);
|
||||
public float3 ywz => new(y,w,z);
|
||||
public float4 ywzx => new(y,w,z,x);
|
||||
public float4 ywzy => new(y,w,z,y);
|
||||
public float4 ywzz => new(y,w,z,z);
|
||||
public float4 ywzw => new(y,w,z,w);
|
||||
public float3 yww => new(y,w,w);
|
||||
public float4 ywwx => new(y,w,w,x);
|
||||
public float4 ywwy => new(y,w,w,y);
|
||||
public float4 ywwz => new(y,w,w,z);
|
||||
public float4 ywww => new(y,w,w,w);
|
||||
// z axis
|
||||
public float z;
|
||||
public float2 zx => new(z,x);
|
||||
public float3 zxx => new(z,x,x);
|
||||
public float4 zxxx => new(z,x,x,x);
|
||||
public float4 zxxy => new(z,x,x,y);
|
||||
public float4 zxxz => new(z,x,x,z);
|
||||
public float4 zxxw => new(z,x,x,w);
|
||||
public float3 zxy => new(z,x,y);
|
||||
public float4 zxyx => new(z,x,y,x);
|
||||
public float4 zxyy => new(z,x,y,y);
|
||||
public float4 zxyz => new(z,x,y,z);
|
||||
public float4 zxyw => new(z,x,y,w);
|
||||
public float3 zxz => new(z,x,z);
|
||||
public float4 zxzx => new(z,x,z,x);
|
||||
public float4 zxzy => new(z,x,z,y);
|
||||
public float4 zxzz => new(z,x,z,z);
|
||||
public float4 zxzw => new(z,x,z,w);
|
||||
public float3 zxw => new(z,x,w);
|
||||
public float4 zxwx => new(z,x,w,x);
|
||||
public float4 zxwy => new(z,x,w,y);
|
||||
public float4 zxwz => new(z,x,w,z);
|
||||
public float4 zxww => new(z,x,w,w);
|
||||
public float2 zy => new(z,y);
|
||||
public float3 zyx => new(z,y,x);
|
||||
public float4 zyxx => new(z,y,x,x);
|
||||
public float4 zyxy => new(z,y,x,y);
|
||||
public float4 zyxz => new(z,y,x,z);
|
||||
public float4 zyxw => new(z,y,x,w);
|
||||
public float3 zyy => new(z,y,y);
|
||||
public float4 zyyx => new(z,y,y,x);
|
||||
public float4 zyyy => new(z,y,y,y);
|
||||
public float4 zyyz => new(z,y,y,z);
|
||||
public float4 zyyw => new(z,y,y,w);
|
||||
public float3 zyz => new(z,y,z);
|
||||
public float4 zyzx => new(z,y,z,x);
|
||||
public float4 zyzy => new(z,y,z,y);
|
||||
public float4 zyzz => new(z,y,z,z);
|
||||
public float4 zyzw => new(z,y,z,w);
|
||||
public float3 zyw => new(z,y,w);
|
||||
public float4 zywx => new(z,y,w,x);
|
||||
public float4 zywy => new(z,y,w,y);
|
||||
public float4 zywz => new(z,y,w,z);
|
||||
public float4 zyww => new(z,y,w,w);
|
||||
public float2 zz => new(z,z);
|
||||
public float3 zzx => new(z,z,x);
|
||||
public float4 zzxx => new(z,z,x,x);
|
||||
public float4 zzxy => new(z,z,x,y);
|
||||
public float4 zzxz => new(z,z,x,z);
|
||||
public float4 zzxw => new(z,z,x,w);
|
||||
public float3 zzy => new(z,z,y);
|
||||
public float4 zzyx => new(z,z,y,x);
|
||||
public float4 zzyy => new(z,z,y,y);
|
||||
public float4 zzyz => new(z,z,y,z);
|
||||
public float4 zzyw => new(z,z,y,w);
|
||||
public float3 zzz => new(z,z,z);
|
||||
public float4 zzzx => new(z,z,z,x);
|
||||
public float4 zzzy => new(z,z,z,y);
|
||||
public float4 zzzz => new(z,z,z,z);
|
||||
public float4 zzzw => new(z,z,z,w);
|
||||
public float3 zzw => new(z,z,w);
|
||||
public float4 zzwx => new(z,z,w,x);
|
||||
public float4 zzwy => new(z,z,w,y);
|
||||
public float4 zzwz => new(z,z,w,z);
|
||||
public float4 zzww => new(z,z,w,w);
|
||||
public float2 zw => new(z,w);
|
||||
public float3 zwx => new(z,w,x);
|
||||
public float4 zwxx => new(z,w,x,x);
|
||||
public float4 zwxy => new(z,w,x,y);
|
||||
public float4 zwxz => new(z,w,x,z);
|
||||
public float4 zwxw => new(z,w,x,w);
|
||||
public float3 zwy => new(z,w,y);
|
||||
public float4 zwyx => new(z,w,y,x);
|
||||
public float4 zwyy => new(z,w,y,y);
|
||||
public float4 zwyz => new(z,w,y,z);
|
||||
public float4 zwyw => new(z,w,y,w);
|
||||
public float3 zwz => new(z,w,z);
|
||||
public float4 zwzx => new(z,w,z,x);
|
||||
public float4 zwzy => new(z,w,z,y);
|
||||
public float4 zwzz => new(z,w,z,z);
|
||||
public float4 zwzw => new(z,w,z,w);
|
||||
public float3 zww => new(z,w,w);
|
||||
public float4 zwwx => new(z,w,w,x);
|
||||
public float4 zwwy => new(z,w,w,y);
|
||||
public float4 zwwz => new(z,w,w,z);
|
||||
public float4 zwww => new(z,w,w,w);
|
||||
// w axis
|
||||
public float w;
|
||||
public float2 wx => new(w,x);
|
||||
public float3 wxx => new(w,x,x);
|
||||
public float4 wxxx => new(w,x,x,x);
|
||||
public float4 wxxy => new(w,x,x,y);
|
||||
public float4 wxxz => new(w,x,x,z);
|
||||
public float4 wxxw => new(w,x,x,w);
|
||||
public float3 wxy => new(w,x,y);
|
||||
public float4 wxyx => new(w,x,y,x);
|
||||
public float4 wxyy => new(w,x,y,y);
|
||||
public float4 wxyz => new(w,x,y,z);
|
||||
public float4 wxyw => new(w,x,y,w);
|
||||
public float3 wxz => new(w,x,z);
|
||||
public float4 wxzx => new(w,x,z,x);
|
||||
public float4 wxzy => new(w,x,z,y);
|
||||
public float4 wxzz => new(w,x,z,z);
|
||||
public float4 wxzw => new(w,x,z,w);
|
||||
public float3 wxw => new(w,x,w);
|
||||
public float4 wxwx => new(w,x,w,x);
|
||||
public float4 wxwy => new(w,x,w,y);
|
||||
public float4 wxwz => new(w,x,w,z);
|
||||
public float4 wxww => new(w,x,w,w);
|
||||
public float2 wy => new(w,y);
|
||||
public float3 wyx => new(w,y,x);
|
||||
public float4 wyxx => new(w,y,x,x);
|
||||
public float4 wyxy => new(w,y,x,y);
|
||||
public float4 wyxz => new(w,y,x,z);
|
||||
public float4 wyxw => new(w,y,x,w);
|
||||
public float3 wyy => new(w,y,y);
|
||||
public float4 wyyx => new(w,y,y,x);
|
||||
public float4 wyyy => new(w,y,y,y);
|
||||
public float4 wyyz => new(w,y,y,z);
|
||||
public float4 wyyw => new(w,y,y,w);
|
||||
public float3 wyz => new(w,y,z);
|
||||
public float4 wyzx => new(w,y,z,x);
|
||||
public float4 wyzy => new(w,y,z,y);
|
||||
public float4 wyzz => new(w,y,z,z);
|
||||
public float4 wyzw => new(w,y,z,w);
|
||||
public float3 wyw => new(w,y,w);
|
||||
public float4 wywx => new(w,y,w,x);
|
||||
public float4 wywy => new(w,y,w,y);
|
||||
public float4 wywz => new(w,y,w,z);
|
||||
public float4 wyww => new(w,y,w,w);
|
||||
public float2 wz => new(w,z);
|
||||
public float3 wzx => new(w,z,x);
|
||||
public float4 wzxx => new(w,z,x,x);
|
||||
public float4 wzxy => new(w,z,x,y);
|
||||
public float4 wzxz => new(w,z,x,z);
|
||||
public float4 wzxw => new(w,z,x,w);
|
||||
public float3 wzy => new(w,z,y);
|
||||
public float4 wzyx => new(w,z,y,x);
|
||||
public float4 wzyy => new(w,z,y,y);
|
||||
public float4 wzyz => new(w,z,y,z);
|
||||
public float4 wzyw => new(w,z,y,w);
|
||||
public float3 wzz => new(w,z,z);
|
||||
public float4 wzzx => new(w,z,z,x);
|
||||
public float4 wzzy => new(w,z,z,y);
|
||||
public float4 wzzz => new(w,z,z,z);
|
||||
public float4 wzzw => new(w,z,z,w);
|
||||
public float3 wzw => new(w,z,w);
|
||||
public float4 wzwx => new(w,z,w,x);
|
||||
public float4 wzwy => new(w,z,w,y);
|
||||
public float4 wzwz => new(w,z,w,z);
|
||||
public float4 wzww => new(w,z,w,w);
|
||||
public float2 ww => new(w,w);
|
||||
public float3 wwx => new(w,w,x);
|
||||
public float4 wwxx => new(w,w,x,x);
|
||||
public float4 wwxy => new(w,w,x,y);
|
||||
public float4 wwxz => new(w,w,x,z);
|
||||
public float4 wwxw => new(w,w,x,w);
|
||||
public float3 wwy => new(w,w,y);
|
||||
public float4 wwyx => new(w,w,y,x);
|
||||
public float4 wwyy => new(w,w,y,y);
|
||||
public float4 wwyz => new(w,w,y,z);
|
||||
public float4 wwyw => new(w,w,y,w);
|
||||
public float3 wwz => new(w,w,z);
|
||||
public float4 wwzx => new(w,w,z,x);
|
||||
public float4 wwzy => new(w,w,z,y);
|
||||
public float4 wwzz => new(w,w,z,z);
|
||||
public float4 wwzw => new(w,w,z,w);
|
||||
public float3 www => new(w,w,w);
|
||||
public float4 wwwx => new(w,w,w,x);
|
||||
public float4 wwwy => new(w,w,w,y);
|
||||
public float4 wwwz => new(w,w,w,z);
|
||||
public float4 wwww => new(w,w,w,w);
|
||||
|
||||
#endregion axis
|
||||
|
||||
#region constructors
|
||||
|
||||
public float4(float x = 0, float y = 0, float z = 0, float w = 0) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
public float4(float v) : this(v, v, v, v) {}
|
||||
|
||||
#endregion constructors
|
||||
|
||||
#region functions
|
||||
|
||||
public float lengthSq => x*x + y*y + z*z + w*w;
|
||||
public float length => math.sqrt(lengthSq);
|
||||
|
||||
public float sum => x + y + z + w;
|
||||
public float mul => x * y * z * w;
|
||||
public float avg => sum * 0.25f;
|
||||
public float min => math.min(x, y, z, w);
|
||||
public float max => math.max(x, y, z, w);
|
||||
|
||||
public float4 normalized { get { float len = 1 / length; return this * len; } }
|
||||
|
||||
public float4 WithLength(float l) { float len = l / length; return this * len; }
|
||||
|
||||
public void FlipX() => x = -x;
|
||||
public void FlipY() => y = -y;
|
||||
public void FlipZ() => z = -z;
|
||||
public void FlipW() => w = -w;
|
||||
|
||||
#endregion functions
|
||||
|
||||
#region operators
|
||||
|
||||
// binary operator '+'
|
||||
public static float4 operator +(float4 a, float4 b) => new(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w);
|
||||
public static float4 operator +(float a, float4 b) => new(a + b.x, a + b.y, a + b.z, a + b.w);
|
||||
public static float4 operator +(float4 a, float b) => new(a.x + b, a.y + b, a.z + b, a.w + b);
|
||||
// binary operator '-'
|
||||
public static float4 operator -(float4 a, float4 b) => new(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w);
|
||||
public static float4 operator -(float a, float4 b) => new(a - b.x, a - b.y, a - b.z, a - b.w);
|
||||
public static float4 operator -(float4 a, float b) => new(a.x - b, a.y - b, a.z - b, a.w - b);
|
||||
// binary operator '*'
|
||||
public static float4 operator *(float4 a, float4 b) => new(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w);
|
||||
public static float4 operator *(float a, float4 b) => new(a * b.x, a * b.y, a * b.z, a * b.w);
|
||||
public static float4 operator *(float4 a, float b) => new(a.x * b, a.y * b, a.z * b, a.w * b);
|
||||
// binary operator '/'
|
||||
public static float4 operator /(float4 a, float4 b) => new(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w);
|
||||
public static float4 operator /(float a, float4 b) => new(a / b.x, a / b.y, a / b.z, a / b.w);
|
||||
public static float4 operator /(float4 a, float b) => new(a.x / b, a.y / b, a.z / b, a.w / b);
|
||||
// equality operator '=='
|
||||
public static bool operator ==(float4 a, float4 b) => a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w;
|
||||
public static bool operator ==(float a, float4 b) => a == b.x && a == b.y && a == b.z && a == b.w;
|
||||
public static bool operator ==(float4 a, float b) => a.x == b && a.y == b && a.z == b && a.w == b;
|
||||
// equality operator '!='
|
||||
public static bool operator !=(float4 a, float4 b) => a.x != b.x || a.y != b.y || a.z != b.z || a.w != b.w;
|
||||
public static bool operator !=(float a, float4 b) => a != b.x || a != b.y || a != b.z || a != b.w;
|
||||
public static bool operator !=(float4 a, float b) => a.x != b || a.y != b || a.z != b || a.w != b;
|
||||
// equality operator '>'
|
||||
public static bool operator >(float4 a, float4 b) => a.x > b.x && a.y > b.y && a.z > b.z && a.w > b.w;
|
||||
public static bool operator >(float a, float4 b) => a > b.x && a > b.y && a > b.z && a > b.w;
|
||||
public static bool operator >(float4 a, float b) => a.x > b && a.y > b && a.z > b && a.w > b;
|
||||
// equality operator '>='
|
||||
public static bool operator >=(float4 a, float4 b) => a.x >= b.x && a.y >= b.y && a.z >= b.z && a.w >= b.w;
|
||||
public static bool operator >=(float a, float4 b) => a >= b.x && a >= b.y && a >= b.z && a >= b.w;
|
||||
public static bool operator >=(float4 a, float b) => a.x >= b && a.y >= b && a.z >= b && a.w >= b;
|
||||
// equality operator '<'
|
||||
public static bool operator <(float4 a, float4 b) => a.x < b.x && a.y < b.y && a.z < b.z && a.w < b.w;
|
||||
public static bool operator <(float a, float4 b) => a < b.x && a < b.y && a < b.z && a < b.w;
|
||||
public static bool operator <(float4 a, float b) => a.x < b && a.y < b && a.z < b && a.w < b;
|
||||
// equality operator '<='
|
||||
public static bool operator <=(float4 a, float4 b) => a.x <= b.x && a.y <= b.y && a.z <= b.z && a.w <= b.w;
|
||||
public static bool operator <=(float a, float4 b) => a <= b.x && a <= b.y && a <= b.z && a <= b.w;
|
||||
public static bool operator <=(float4 a, float b) => a.x <= b && a.y <= b && a.z <= b && a.w <= b;
|
||||
// other operators
|
||||
public static float4 operator -(float4 a) => new(-a.x, -a.y, -a.z, -a.w);
|
||||
public static implicit operator float4(float v) => new(v);
|
||||
public static implicit operator float4(int v) => new(v);
|
||||
|
||||
public float4(float2 a, float z, float w) {
|
||||
x = a.x;
|
||||
y = a.y;
|
||||
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
public static implicit operator float2(float4 v) => v.xy;
|
||||
public static implicit operator float4(float2 v) => new(v.x, v.y, 0, 0);
|
||||
public float4(float3 a, float w) {
|
||||
x = a.x;
|
||||
y = a.y;
|
||||
z = a.z;
|
||||
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
public static implicit operator float3(float4 v) => v.xyz;
|
||||
public static implicit operator float4(float3 v) => new(v.x, v.y, v.z, 0);
|
||||
|
||||
#endregion operators
|
||||
|
||||
#region staticFunc
|
||||
|
||||
public static float4 Min(float4 a, float4 b) => new(math.min(a.x, b.x), math.min(a.y, b.y), math.min(a.z, b.z), math.min(a.w, b.w));
|
||||
public static float4 Min(float4 a, float4 b, float4 c) => new(math.min(a.x, b.x, c.x), math.min(a.y, b.y, c.y), math.min(a.z, b.z, c.z), math.min(a.w, b.w, c.w));
|
||||
public static float4 Min(float4 a, float4 b, float4 c, float4 d) => new(math.min(a.x, b.x, c.x, d.x), math.min(a.y, b.y, c.y, d.y), math.min(a.z, b.z, c.z, d.z), math.min(a.w, b.w, c.w, d.w));
|
||||
|
||||
public static float4 Max(float4 a, float4 b) => new(math.max(a.x, b.x), math.max(a.y, b.y), math.max(a.z, b.z), math.max(a.w, b.w));
|
||||
public static float4 Max(float4 a, float4 b, float4 c) => new(math.max(a.x, b.x, c.x), math.max(a.y, b.y, c.y), math.max(a.z, b.z, c.z), math.max(a.w, b.w, c.w));
|
||||
public static float4 Max(float4 a, float4 b, float4 c, float4 d) => new(math.max(a.x, b.x, c.x, d.x), math.max(a.y, b.y, c.y, d.y), math.max(a.z, b.z, c.z, d.z), math.max(a.w, b.w, c.w, d.w));
|
||||
|
||||
public static float4 Clamp(float4 v, float4 min, float4 max) => Max(Min(v, max), min);
|
||||
|
||||
#endregion staticFunc
|
||||
|
||||
#region impl
|
||||
|
||||
public bool Equals(float4 other) => x == other.x && y == other.y && z == other.z && w == other.w;
|
||||
public override bool Equals(object? obj) => obj is float4 other && Equals(other);
|
||||
public override int GetHashCode() => HashCode.Combine(x, y, z, w);
|
||||
|
||||
public override string ToString() => $"({x},{y},{z},{w})";
|
||||
|
||||
#endregion impl
|
||||
|
||||
#region other
|
||||
|
||||
public static implicit operator float4(color v) => new(v.rF, v.gF, v.bF, v.aF);
|
||||
public static implicit operator color(float4 v) => new(v.x, v.y, v.z, v.w);
|
||||
public static float Dot(float4 a, float4 b) => a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
|
||||
|
||||
#endregion other
|
||||
}
|
|
@ -1,226 +0,0 @@
|
|||
<#@ template language="C#v3.5" #>
|
||||
<#@ import namespace="System.Text"#>
|
||||
<#@ import namespace="System.Collections"#>
|
||||
<#@ import namespace="System.Collections.Generic"#>
|
||||
<#@ assembly name="System.Core"#>
|
||||
<#@ import namespace="System.Linq"#>
|
||||
<#
|
||||
char[] axisNames = {'x', 'y', 'z', 'w'};
|
||||
int[] axisCount = {2, 3, 4};
|
||||
int runCount = axisCount.Length;
|
||||
#>
|
||||
/* GENERATED USING T4 */
|
||||
|
||||
// ReSharper disable CompareOfFloatsByEqualityOperator
|
||||
// ReSharper disable IdentifierTypo
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
using SomeChartsUi.themes.colors;
|
||||
namespace SomeChartsUi.utils.vectors;
|
||||
|
||||
<#
|
||||
for (int iter = 0; iter < runCount; iter++) {
|
||||
string vecName = $"float{axisCount[iter]}";
|
||||
int aCount = axisCount[iter];
|
||||
char[] curAxis = axisNames.Take(aCount).ToArray();
|
||||
#>
|
||||
public struct <#=vecName#> {
|
||||
#region staticFields
|
||||
|
||||
public static readonly <#=vecName#> zero = new(0);
|
||||
public static readonly <#=vecName#> one = new(1);
|
||||
public static readonly <#=vecName#> maxValue = new(float.MaxValue);
|
||||
public static readonly <#=vecName#> minValue = new(float.MinValue);
|
||||
public static readonly <#=vecName#> up = new(0,1);
|
||||
public static readonly <#=vecName#> down = new(0,-1);
|
||||
public static readonly <#=vecName#> right = new(1,0);
|
||||
public static readonly <#=vecName#> left = new(-1,0);
|
||||
|
||||
<#
|
||||
if (aCount > 2) {
|
||||
#>
|
||||
public static readonly <#=vecName#> front = new(0,0,1);
|
||||
public static readonly <#=vecName#> back = new(0,0,-1);
|
||||
<#
|
||||
}
|
||||
#>
|
||||
|
||||
#endregion staticFields
|
||||
|
||||
#region axis
|
||||
|
||||
<#
|
||||
// enter axis field and property gen
|
||||
for (int i = 0; i < aCount; i++) {
|
||||
char axis0 = axisNames[i];
|
||||
#>
|
||||
// <#=axis0#> axis
|
||||
public float <#=axis0#>;
|
||||
<#
|
||||
for (int j = 0; j < aCount; j++) {
|
||||
char axis1 = axisNames[j];
|
||||
#>
|
||||
public float2 <#=axis0#><#=axis1#> => new(<#=axis0#>,<#=axis1#>);
|
||||
<#
|
||||
for (int k = 0; k < aCount; k++) {
|
||||
char axis2 = axisNames[k];
|
||||
#>
|
||||
public float3 <#=axis0#><#=axis1#><#=axis2#> => new(<#=axis0#>,<#=axis1#>,<#=axis2#>);
|
||||
<#
|
||||
for (int l = 0; l < aCount; l++) {
|
||||
char axis3 = axisNames[l];
|
||||
#>
|
||||
public float4 <#= axis0 #><#= axis1 #><#= axis2 #><#= axis3 #> => new(<#= axis0 #>,<#= axis1 #>,<#= axis2 #>,<#= axis3 #>);
|
||||
<#
|
||||
// exit axis field and property gen
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#>
|
||||
|
||||
#endregion axis
|
||||
|
||||
#region constructors
|
||||
|
||||
public <#=vecName#>(<#=string.Join(", ", axisNames.Take(aCount).Select(v => $"float {v} = 0"))#>) {
|
||||
<#=string.Join("\n ", axisNames.Take(aCount).Select(v => $"this.{v} = {v};"))#>
|
||||
}
|
||||
public <#=vecName#>(float v) : this(<#=string.Join(", ", axisNames.Take(aCount).Select(_ => "v"))#>) {}
|
||||
|
||||
#endregion constructors
|
||||
|
||||
#region functions
|
||||
|
||||
public float lengthSq => <#=string.Join(" + ", curAxis.Select(v => $"{v}*{v}"))#>;
|
||||
public float length => math.sqrt(lengthSq);
|
||||
|
||||
public float sum => <#=string.Join(" + ", curAxis)#>;
|
||||
public float mul => <#=string.Join(" * ", curAxis)#>;
|
||||
public float avg => sum * <#=1f / aCount#>f;
|
||||
public float min => math.min(<#=string.Join(", ", curAxis)#>);
|
||||
public float max => math.max(<#=string.Join(", ", curAxis)#>);
|
||||
|
||||
public <#= vecName #> normalized { get { float len = 1 / length; return this * len; } }
|
||||
|
||||
public <#= vecName #> WithLength(float l) { float len = l / length; return this * len; }
|
||||
|
||||
<#
|
||||
for (int i = 0; i < aCount; i++) {
|
||||
char axis0 = axisNames[i];
|
||||
#>
|
||||
public void Flip<#=axis0.ToString().ToUpper()#>() => <#=axis0#> = -<#=axis0#>;
|
||||
<#
|
||||
}
|
||||
#>
|
||||
|
||||
#endregion functions
|
||||
|
||||
#region operators
|
||||
|
||||
<#
|
||||
string[] binaryOperators = {"+", "-", "*", "/"};
|
||||
foreach (string op in binaryOperators) {
|
||||
#>
|
||||
// binary operator '<#=op#>'
|
||||
public static <#= vecName #> operator <#=op#>(<#= vecName #> a, <#= vecName #> b) => new(<#= string.Join(", ", curAxis.Select(v => $"a.{v} {op} b.{v}")) #>);
|
||||
public static <#= vecName #> operator <#=op#>(float a, <#= vecName #> b) => new(<#= string.Join(", ", curAxis.Select(v => $"a {op} b.{v}")) #>);
|
||||
public static <#= vecName #> operator <#=op#>(<#= vecName #> a, float b) => new(<#= string.Join(", ", curAxis.Select(v => $"a.{v} {op} b")) #>);
|
||||
<#
|
||||
}
|
||||
(string s, string concatOp)[] eqOperators = {
|
||||
("==", "&&"),
|
||||
("!=", "||"),
|
||||
(">", "&&"),
|
||||
(">=", "&&"),
|
||||
("<", "&&"),
|
||||
("<=", "&&"),
|
||||
};
|
||||
foreach ((string op, string concatOp) in eqOperators) {
|
||||
#>
|
||||
// equality operator '<#=op#>'
|
||||
public static bool operator <#=op#>(<#= vecName #> a, <#= vecName #> b) => <#= string.Join($" {concatOp} ", curAxis.Select(v => $"a.{v} {op} b.{v}")) #>;
|
||||
public static bool operator <#=op#>(float a, <#= vecName #> b) => <#= string.Join($" {concatOp} ", curAxis.Select(v => $"a {op} b.{v}")) #>;
|
||||
public static bool operator <#=op#>(<#= vecName #> a, float b) => <#= string.Join($" {concatOp} ", curAxis.Select(v => $"a.{v} {op} b")) #>;
|
||||
<#
|
||||
}
|
||||
#>
|
||||
// other operators
|
||||
public static <#= vecName #> operator -(<#= vecName #> a) => new(<#= string.Join($", ", curAxis.Select(v => $"-a.{v}")) #>);
|
||||
public static implicit operator <#= vecName #>(float v) => new(v);
|
||||
public static implicit operator <#= vecName #>(int v) => new(v);
|
||||
|
||||
<#
|
||||
for (int i = 1; i < aCount - 1; i++) {
|
||||
string vecName2 = $"float{i + 1}";
|
||||
#>
|
||||
public <#= vecName #>(<#= vecName2 #> a, <#=string.Join(", ", curAxis.Skip(i+1).Select(v => $"float {v}"))#>) {
|
||||
<#=string.Join("", curAxis.Take(i+1).Select(v => $" {v} = a.{v};\n"))#>
|
||||
<#=string.Join("", curAxis.Skip(i+1).Select(v => $" this.{v} = {v};\n"))#> }
|
||||
|
||||
public static implicit operator <#= vecName2 #>(<#= vecName #> v) => v.<#=string.Join("", curAxis.Take(i+1).Select(v => $"{v}"))#>;
|
||||
public static implicit operator <#= vecName #>(<#= vecName2 #> v) => new(<#=string.Join(", ", curAxis.Take(i+1).Select(v => $"v.{v}"))#><#= string.Concat(Enumerable.Repeat(", 0", aCount - i - 1)) #>);
|
||||
<#
|
||||
}
|
||||
#>
|
||||
|
||||
#endregion operators
|
||||
|
||||
#region staticFunc
|
||||
|
||||
public static <#= vecName #> Min(<#= vecName #> a, <#= vecName #> b) => new(<#= string.Join(", ", curAxis.Select(v => $"math.min(a.{v}, b.{v})")) #>);
|
||||
public static <#= vecName #> Min(<#= vecName #> a, <#= vecName #> b, <#= vecName #> c) => new(<#= string.Join(", ", curAxis.Select(v => $"math.min(a.{v}, b.{v}, c.{v})")) #>);
|
||||
public static <#= vecName #> Min(<#= vecName #> a, <#= vecName #> b, <#= vecName #> c, <#= vecName #> d) => new(<#= string.Join(", ", curAxis.Select(v => $"math.min(a.{v}, b.{v}, c.{v}, d.{v})")) #>);
|
||||
|
||||
public static <#= vecName #> Max(<#= vecName #> a, <#= vecName #> b) => new(<#= string.Join(", ", curAxis.Select(v => $"math.max(a.{v}, b.{v})")) #>);
|
||||
public static <#= vecName #> Max(<#= vecName #> a, <#= vecName #> b, <#= vecName #> c) => new(<#= string.Join(", ", curAxis.Select(v => $"math.max(a.{v}, b.{v}, c.{v})")) #>);
|
||||
public static <#= vecName #> Max(<#= vecName #> a, <#= vecName #> b, <#= vecName #> c, <#= vecName #> d) => new(<#= string.Join(", ", curAxis.Select(v => $"math.max(a.{v}, b.{v}, c.{v}, d.{v})")) #>);
|
||||
|
||||
public static <#= vecName #> Clamp(<#= vecName #> v, <#= vecName #> min, <#= vecName #> max) => Max(Min(v, max), min);
|
||||
|
||||
#endregion staticFunc
|
||||
|
||||
#region impl
|
||||
|
||||
public bool Equals(<#= vecName #> other) => <#= string.Join(" && ", curAxis.Select(v => $"{v} == other.{v}")) #>;
|
||||
public override bool Equals(object? obj) => obj is <#= vecName #> other && Equals(other);
|
||||
public override int GetHashCode() => HashCode.Combine(<#= string.Join(", ", curAxis) #>);
|
||||
|
||||
public override string ToString() => $"(<#= string.Join(",", curAxis.Select(v => $"{{{v}}}")) #>)";
|
||||
|
||||
#endregion impl
|
||||
|
||||
#region other
|
||||
|
||||
<#
|
||||
switch (aCount) {
|
||||
case 2:{
|
||||
#>
|
||||
public static float2 SinCos(float radians, float length) => new(MathF.Sin(radians) * length, MathF.Cos(radians) * length);
|
||||
<#
|
||||
break;
|
||||
}
|
||||
case 3:{
|
||||
#>
|
||||
public static implicit operator <#= vecName #>(color v) => new(v.rF, v.gF, v.bF);
|
||||
public static implicit operator color(<#= vecName #> v) => new(v.x, v.y, v.z);
|
||||
|
||||
public static float3 Cross(float3 a, float3 b) => new(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
|
||||
<#
|
||||
break;
|
||||
}
|
||||
case 4:{
|
||||
#>
|
||||
public static implicit operator <#= vecName #>(color v) => new(v.rF, v.gF, v.bF, v.aF);
|
||||
public static implicit operator color(<#= vecName #> v) => new(v.x, v.y, v.z, v.w);
|
||||
<#
|
||||
break;
|
||||
}
|
||||
}
|
||||
#>
|
||||
public static float Dot(<#= vecName #> a, <#= vecName #> b) => <#= string.Join(" + ", curAxis.Select(v => $"a.{v} * b.{v}"))#>;
|
||||
|
||||
#endregion other
|
||||
}
|
||||
<#
|
||||
}
|
||||
#>
|
|
@ -25,6 +25,7 @@
|
|||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.11" />
|
||||
<PackageReference Include="HarfBuzzSharp" Version="2.8.2-preview.187" />
|
||||
<PackageReference Include="MathStuff" Version="1.0.0" />
|
||||
<PackageReference Include="SkiaSharp.HarfBuzz" Version="2.88.0-preview.187" />
|
||||
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
|
||||
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using Avalonia.OpenGL;
|
||||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.backends;
|
||||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.ui.text;
|
||||
using SomeChartsUi.utils.mesh;
|
||||
using SomeChartsUi.utils.shaders;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using SomeChartsUiAvalonia.controls.gl;
|
||||
using SomeChartsUiAvalonia.utils;
|
||||
using SomeChartsUiAvalonia.utils.collections;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
using System;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Skia;
|
||||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.HarfBuzz;
|
||||
using SomeChartsUi.backends;
|
||||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.ui.text;
|
||||
using SomeChartsUi.utils.mesh;
|
||||
using SomeChartsUi.utils.shaders;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using SomeChartsUiAvalonia.utils;
|
||||
|
||||
namespace SomeChartsUiAvalonia.backends;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using MathStuff.vectors;
|
||||
using SkiaSharp;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using SomeChartsUiAvalonia.utils;
|
||||
|
||||
namespace SomeChartsUiAvalonia.backends;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using SomeChartsUi.ui;
|
|||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.canvas.controls;
|
||||
using SomeChartsUiAvalonia.backends;
|
||||
using SomeChartsUiAvalonia.utils.collections;
|
||||
|
||||
namespace SomeChartsUiAvalonia.controls.gl;
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ using Avalonia.Input;
|
|||
using Avalonia.OpenGL;
|
||||
using Avalonia.OpenGL.Controls;
|
||||
using Avalonia.Threading;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.themes.themes;
|
||||
using SomeChartsUi.ui;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.ui.layers;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using SomeChartsUiAvalonia.backends;
|
||||
using SomeChartsUiAvalonia.utils;
|
||||
using static Avalonia.OpenGL.GlConsts;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<#@ template language="C#v3.5" #>
|
||||
<#@ import namespace="System"#>
|
||||
<#@ import namespace="System.Text"#>
|
||||
<#@ import namespace="System.Collections"#>
|
||||
<#@ import namespace="System.Collections.Generic"#>
|
||||
<#@ assembly name="System.Core"#>
|
||||
<#@ import namespace="System.Linq"#>
|
||||
<#
|
||||
var functions = new[] {
|
||||
new{name = "GenVertexArrays", ret = "void", args = "int count, int[] arrays"},
|
||||
|
|
|
@ -2,10 +2,10 @@ using System;
|
|||
using System.Threading;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using MathStuff.vectors;
|
||||
using SkiaSharp;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.ui.elements;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using SomeChartsUiAvalonia.backends;
|
||||
|
||||
namespace SomeChartsUiAvalonia.controls.skia;
|
||||
|
|
|
@ -2,10 +2,10 @@ using System.Diagnostics;
|
|||
using Avalonia;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Media;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.themes.themes;
|
||||
using SomeChartsUi.ui;
|
||||
using SomeChartsUi.ui.canvas;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using SomeChartsUiAvalonia.utils;
|
||||
|
||||
namespace SomeChartsUiAvalonia.controls.skia;
|
||||
|
|
|
@ -3,8 +3,8 @@ using System.Linq;
|
|||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Avalonia.OpenGL;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.utils.shaders;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using SomeChartsUiAvalonia.controls.gl;
|
||||
|
||||
namespace SomeChartsUiAvalonia.utils;
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
using System;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.IO;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.OpenGL;
|
||||
using Avalonia.OpenGL.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using SomeChartsUi.utils.shaders;
|
||||
using SomeChartsUiAvalonia.controls.gl;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Input;
|
||||
using MathStuff;
|
||||
using MathStuff.vectors;
|
||||
using SkiaSharp;
|
||||
using SomeChartsUi.themes.colors;
|
||||
using SomeChartsUi.ui;
|
||||
using SomeChartsUi.utils.rects;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
|
||||
namespace SomeChartsUiAvalonia.utils;
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MathStuff;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.HarfBuzz;
|
||||
using SomeChartsUi.ui.text;
|
||||
using SomeChartsUi.utils;
|
||||
|
||||
namespace SomeChartsUiAvalonia.utils;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using MathStuff.vectors;
|
||||
using SomeChartsUi.utils.mesh;
|
||||
using SomeChartsUi.utils.shaders;
|
||||
using SomeChartsUi.utils.vectors;
|
||||
using SomeChartsUiAvalonia.controls.gl;
|
||||
using static Avalonia.OpenGL.GlConsts;
|
||||
namespace SomeChartsUiAvalonia.utils.collections;
|
||||
|
|
Загрузка…
Ссылка в новой задаче