6 public struct Point : IEquatable<Point> {
52 bool IEquatable<Point>.Equals(
Point other) {
76 int count = positions.
Count;
78 for (
int i = 0; i < positions.
Count; i++) {
79 if (!rectangle.
Contains(positions[i])) {
91 positions[0] = ray.Position + ray.Direction * num2;
93 return count - positions.
Count;
104 int count = positions.
Count;
106 for (
int i = 0; i < positions.
Count; i++) {
107 if (!circle.
Contains(positions[i])) {
119 positions[0] = ray.Position + ray.Direction * num2;
121 return count - positions.
Count;
132 DynamicArray<bool> visibility,
134 DynamicArray<Vector2> normals) {
135 if (positions.
Count == 0) {
139 bool[] array2 = visibility?.
Array;
140 if (array2 !=
null) {
142 for (
int i = 0; i < positions.
Count; i++) {
143 int num = (i - 1 + positions.
Count) % positions.
Count;
145 int num3 = (i + 1) % positions.
Count;
146 normals.
Add(array2[num] || array2[num2] ?
Normal2(array[num2] - array[num], array[num3] - array[num2]) :
default);
150 normals.
Add(array2[0] ?
Normal1(array[1] - array[0]) :
default);
151 for (
int j = 1; j < positions.Count - 1; j++) {
152 normals.
Add(array2[j - 1] || array2[j] ?
Normal2(array[j] - array[j - 1], array[j + 1] - array[j]) :
default);
154 if (positions.
Count >= 2) {
159 for (
int k = 0; k < positions.
Count; k++) {
160 int num4 = (k - 1 + positions.
Count) % positions.
Count;
162 int num6 = (k + 1) % positions.
Count;
163 normals.
Add(
Normal2(array[num5] - array[num4], array[num6] - array[num5]));
168 for (
int l = 1; l < positions.Count - 1; l++) {
169 normals.
Add(
Normal2(array[l] - array[l - 1], array[l + 1] - array[l]));
171 if (positions.
Count >= 2) {
178 DynamicArray<Point> points,
179 DynamicArray<bool> visibility,
183 TmpPositions.Count = 0;
184 foreach (
Point point
in points) {
187 TmpNormals.Count = 0;
201 DynamicArray<Point> points,
202 DynamicArray<Vector2> normals,
203 DynamicArray<bool> visibility,
219 DynamicArray<Vector2> positions,
220 DynamicArray<bool> visibility,
249 DynamicArray<Vector2> positions,
250 DynamicArray<bool> visibility,
263 Point point =
default;
264 point.InnerRadiusL = innerRadiusL;
265 point.InnerRadiusR = innerRadiusR;
266 point.OuterRadiusL = outerRadiusL;
267 point.OuterRadiusR = outerRadiusR;
268 point.InnerColorL = innerColorL;
269 point.InnerColorR = innerColorR;
270 point.OuterColorL = outerColorL;
271 point.OuterColorR = outerColorR;
272 point.MiterLimit = miterLimit;
274 TmpPoints.Count = positions.
Count;
275 for (
int i = 0; i < positions.
Count; i++) {
276 value.Position = positions[i];
279 TmpNormals.Count = 0;
293 DynamicArray<Point> points,
294 DynamicArray<bool> visibility,
299 TmpPositions.Count = 0;
300 foreach (
Point point
in points) {
303 TmpNormals.Count = 0;
318 DynamicArray<Point> points,
319 DynamicArray<Vector2> normals,
320 DynamicArray<bool> visibility,
338 DynamicArray<Vector2> positions,
339 DynamicArray<bool> visibility,
372 DynamicArray<Vector2> positions,
373 DynamicArray<bool> visibility,
388 Point point =
default;
389 point.InnerRadiusL = innerRadiusL;
390 point.InnerRadiusR = innerRadiusR;
391 point.OuterRadiusL = outerRadiusL;
392 point.OuterRadiusR = outerRadiusR;
393 point.InnerColorL = innerColorL;
394 point.InnerColorR = innerColorR;
395 point.OuterColorL = outerColorL;
396 point.OuterColorR = outerColorR;
397 point.LengthScale = lengthScale;
398 point.MiterLimit = miterLimit;
400 TmpPoints.Count = positions.
Count;
401 for (
int i = 0; i < positions.
Count; i++) {
402 value.Position = positions[i];
405 TmpNormals.Count = 0;
421 DynamicArray<Point> points,
422 DynamicArray<Vector2> normals,
423 DynamicArray<bool> visibility,
429 int num = loop ? normals.Count : normals.Count - 1;
430 for (
int i = 0; i < num; i++) {
431 if (visibility !=
null
436 int index2 = (i + 1) % normals.
Count;
437 Point point = points[index];
438 Point point2 = points[index2];
441 Vector2 vector = normals[index];
442 Vector2 vector2 = normals[index2];
444 vector =
Normal1(position2 - position);
447 vector2 =
Normal1(position2 - position);
493 position2 + vector10,
506 position2 + vector10,
520 DynamicArray<Point> points,
521 DynamicArray<Vector2> normals,
522 DynamicArray<bool> visibility,
529 float num = lengthOffset;
530 int num2 = loop ? normals.Count : normals.Count - 1;
531 for (
int i = 0; i < num2; i++) {
532 if (visibility !=
null
537 int index2 = (i + 1) % normals.
Count;
538 Point point = points[index];
539 Point point2 = points[index2];
543 Vector2 vector = position2 - position;
544 float num4 = vector.
Length();
545 Vector2 v = vector / num4 * num3;
546 Vector2 vector2 = normals[index];
547 Vector2 vector3 = normals[index2];
549 vector2 =
Normal1(position2 - position);
552 vector3 =
Normal1(position2 - position);
554 Vector2 vector4 =
new(num, 0.5f);
556 Vector2 vector5 =
new(num, 0.5f);
616 position2 + vector16,
617 position2 + vector17,
633 position2 + vector16,
634 position2 + vector17,
654 float num = MathF.Tan(((
float)Math.PI -
Vector2.
Angle(d1, d2)) / 2f);
void RemoveRange(int index, int count)
void QueueQuad(Vector2 corner1, Vector2 corner2, float depth, Color color)
void QueueQuad(Vector2 corner1, Vector2 corner2, float depth, Vector2 texCoord1, Vector2 texCoord2, Color color)
static void QueuePath(FlatBatch2D batch, DynamicArray< Vector2 > positions, DynamicArray< bool > visibility, bool loop, bool flatShading, float innerRadiusL, float innerRadiusR, float outerRadiusL, float outerRadiusR, Color innerColorL, Color innerColorR, Color outerColorL, Color outerColorR, float miterLimit, float depth=0f)
static int TrimPathStart(DynamicArray< Vector2 > positions, BoundingCircle circle)
static DynamicArray< Vector2 > TmpNormals
static int TrimPathEnd(DynamicArray< Vector2 > positions, BoundingCircle circle)
static void QueuePath(FlatBatch2D batch, DynamicArray< Vector2 > positions, DynamicArray< bool > visibility, bool loop, bool flatShading, float innerRadius, float outerRadius, Color innerColor, Color outerColor, float miterLimit, float depth=0f)
static int TrimPathStart(DynamicArray< Vector2 > positions, BoundingRectangle rectangle)
static void QueuePathInternal(TexturedBatch2D batch, DynamicArray< Point > points, DynamicArray< Vector2 > normals, DynamicArray< bool > visibility, bool loop, bool flatShading, float lengthOffset, float depth)
static DynamicArray< Vector2 > TmpPositions
static void QueuePath(TexturedBatch2D batch, DynamicArray< Vector2 > positions, DynamicArray< bool > visibility, bool loop, bool flatShading, float innerRadius, float outerRadius, Color innerColor, Color outerColor, float lengthScale, float lengthOffset, float miterLimit, float depth=0f)
static void GeneratePathNormals(DynamicArray< Vector2 > positions, DynamicArray< bool > visibility, bool loop, DynamicArray< Vector2 > normals)
static Vector2 Normal2(Vector2 d1, Vector2 d2)
static DynamicArray< Point > TmpPoints
static void QueuePathInternal(FlatBatch2D batch, DynamicArray< Point > points, DynamicArray< Vector2 > normals, DynamicArray< bool > visibility, bool loop, bool flatShading, float depth)
static void QueuePath(FlatBatch2D batch, DynamicArray< Point > points, DynamicArray< bool > visibility, bool loop, bool flatShading, float depth=0f)
static void QueuePath(FlatBatch2D batch, DynamicArray< Point > points, DynamicArray< Vector2 > normals, DynamicArray< bool > visibility, bool loop, bool flatShading, float depth=0f)
static void QueuePath(TexturedBatch2D batch, DynamicArray< Point > points, DynamicArray< Vector2 > normals, DynamicArray< bool > visibility, bool loop, bool flatShading, float lengthOffset, float depth=0f)
static void QueuePath(TexturedBatch2D batch, DynamicArray< Point > points, DynamicArray< bool > visibility, bool loop, bool flatShading, float lengthOffset, float depth=0f)
static int TrimPathEnd(DynamicArray< Vector2 > positions, BoundingRectangle rectangle)
static void QueuePath(TexturedBatch2D batch, DynamicArray< Vector2 > positions, DynamicArray< bool > visibility, bool loop, bool flatShading, float innerRadiusL, float innerRadiusR, float outerRadiusL, float outerRadiusR, Color innerColorL, Color innerColorR, Color outerColorL, Color outerColorR, float lengthScale, float lengthOffset, float miterLimit, float depth=0f)
static Vector2 Normal1(Vector2 d)
float? Intersection(BoundingRectangle rectangle)
static float Dot(Vector2 v1, Vector2 v2)
static Vector2 Normalize(Vector2 v)
static float Angle(Vector2 v1, Vector2 v2)
static Vector2 Perpendicular(Vector2 v)