daily update on 2024.03.18 by itload youmu

This commit is contained in:
YoumuLiu
2024-03-19 02:41:04 +08:00
parent 15bf989285
commit 0c50c6282e
200 changed files with 7663 additions and 3455 deletions
@@ -1,4 +1,35 @@
using StgSharp.Math;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Arc.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Math;
using System;
namespace StgSharp.Geometries
@@ -8,20 +39,40 @@ namespace StgSharp.Geometries
/// </summary>
public class Arc : PlainGeometry
{
internal Point center;
internal Point beginPoint;
internal Point center;
internal Point endPoint;
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal override int[] Indices => throw new NotImplementedException();
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
public override Line[] GetAllSides()
{
throw new NotImplementedException();
}
public virtual vec3d MovBegin(uint tick) => movBeginOperation.Invoke(tick);
public override Plain GetPlain()
{
return new Plain(this.center, this.beginPoint, this.endPoint);
}
public virtual vec3d MovEnd(uint tick) => movEndOperation.Invoke(tick);
public virtual vec3d MovBegin(uint tick)
{
return movBeginOperation.Invoke(tick);
}
public virtual vec3d MoveCenter(uint tick)
{
return movCenterOperation.Invoke(tick);
}
public virtual vec3d MovEnd(uint tick)
{
return movEndOperation.Invoke(tick);
}
internal override void UpdateCoordinate(uint tick)
{
@@ -31,12 +82,5 @@ namespace StgSharp.Geometries
endPoint.Position = this.coordinate.origin + MovEnd(tick);
}
public override Line[] GetAllSides() => throw new NotImplementedException();
public override Plain GetPlain()
{
return new Plain(this.center, this.beginPoint, this.endPoint);
}
}
}
@@ -1,4 +1,35 @@
using StgSharp.Math;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Circle.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Math;
using System;
namespace StgSharp.Geometries
@@ -8,27 +39,42 @@ namespace StgSharp.Geometries
/// </summary>
public class Circle : PlainGeometry
{
internal Point center;
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal Point pointOnCircle;
internal Point pointOnPlain;
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal override int[] Indices => throw new NotImplementedException();
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
public virtual vec3d UpdateRadius(uint tick) => movBeginOperation.Invoke(tick);
public virtual vec3d UpdatePlain(uint tick) => movEndOperation.Invoke(tick);
public override Line[] GetAllSides()
{
throw new NotImplementedException();
}
public override Plain GetPlain()
{
return new Plain(center, pointOnCircle, pointOnPlain);
}
public virtual vec3d MoveCenter(uint tick)
{
return movCenterOperation.Invoke(tick);
}
public virtual vec3d UpdatePlain(uint tick)
{
return movEndOperation.Invoke(tick);
}
public virtual vec3d UpdateRadius(uint tick)
{
return movBeginOperation.Invoke(tick);
}
internal override void UpdateCoordinate(uint tick)
{
@@ -38,9 +84,5 @@ namespace StgSharp.Geometries
pointOnPlain.Position = this.coordinate.origin + UpdatePlain(tick);
}
public override Line[] GetAllSides()
{
throw new NotImplementedException();
}
}
}
@@ -1,4 +1,35 @@
using StgSharp.Math;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Cordinate.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -12,30 +43,13 @@ namespace StgSharp.Geometries
[StructLayout(LayoutKind.Sequential)]
public struct PartialPlainCoordinate
{
/// <summary>
/// The origin of this coordinate.
/// </summary>
public vec3d origin;
internal Matrix3x2 axis;
/// <summary>
/// The horizontial axis of the coordinate.
/// Point to the right direction.
/// </summary>
public vec3d axis_H
{
get { return axis.colum0; }
}
/// <summary>
/// The vertical axis of the coordinate.
/// Point to the top direction.
/// </summary>
public vec3d axis_V
{
get { return axis.colum1; }
}
public PartialPlainCoordinate
(
vec3d origin,
@@ -52,6 +66,18 @@ namespace StgSharp.Geometries
axis.colum1 = vertical;
}
/// <summary>
/// The horizontial axis of the coordinate.
/// Point to the right direction.
/// </summary>
public vec3d axis_H => axis.colum0;
/// <summary>
/// The vertical axis of the coordinate.
/// Point to the top direction.
/// </summary>
public vec3d axis_V => axis.colum1;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public vec3d GetRealLocate(Vec2d raletiveLocation)
{
@@ -1,4 +1,34 @@
namespace StgSharp.Geometries
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpressionHandler.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
namespace StgSharp.Geometries
{
public delegate float ExpressionHandler
(
@@ -1,10 +1,44 @@
using System;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="GemoryException.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Runtime.Serialization;
namespace StgSharp.Geometries
{
public unsafe class ToUpperDimensionException : Exception
{
protected ToUpperDimensionException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
public ToUpperDimensionException()
{
}
@@ -17,9 +51,6 @@ namespace StgSharp.Geometries
{
}
protected ToUpperDimensionException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
/// <summary>
@@ -27,6 +58,10 @@ namespace StgSharp.Geometries
/// </summary>
public class UnusedVertexException : Exception
{
protected UnusedVertexException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
public UnusedVertexException()
{
}
@@ -39,8 +74,5 @@ namespace StgSharp.Geometries
{
}
protected UnusedVertexException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
@@ -1,4 +1,34 @@
using StgSharp.Math;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="GeometryOperation.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Math;
namespace StgSharp.Geometries
{
@@ -11,10 +41,12 @@ namespace StgSharp.Geometries
public static unsafe class GeometryOperation
{
public static vec3d DefualtMotion(uint tick)
{
return default(vec3d);
}
}
}
@@ -1,4 +1,35 @@
using StgSharp.Math;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Line.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Math;
using System;
using System.Numerics;
@@ -6,24 +37,13 @@ namespace StgSharp.Geometries
{
public class Line : PlainGeometry
{
internal Point basePoint;
internal Point beginPoint;
internal Point endPoint;
internal GetLocationHandler movBegin;
internal GetLocationHandler movEnd;
internal override int[] Indices
{
get { throw new Exception(); }
}
public Line(Point begin, Point end)
{
this.beginPoint = begin;
this.endPoint = end;
}
internal Line(Vector4 begin, Vector4 end)
{
beginPoint = new Point(begin);
@@ -32,31 +52,15 @@ namespace StgSharp.Geometries
public Line() { }
/// <summary>
/// Move begin side of a line.
/// It is recommended to override this function rather than
/// loading an <see cref="GetLocationHandler"/> with same function.
/// </summary>
/// <param name="tick">Time passed since current line was created.</param>
public virtual vec3d MoveBeginPoint(uint tick)
=> movBegin.Invoke(time);
/// <summary>
/// Move end side of a line.
/// It is recommended to override this function rather than
/// loading an <see cref="GetLocationHandler"/> with same function.
/// </summary>
/// <param name="tick">Time passed since current line was created.</param>
/// <returns></returns>
public virtual vec3d MoveEndPoint(uint tick)
=> movEnd.Invoke(time);
internal override void UpdateCoordinate(uint tick)
public Line(Point begin, Point end)
{
beginPoint.Position = coordinate.origin + MoveBeginPoint(time);
endPoint.Position = coordinate.origin + MoveEndPoint(time);
this.beginPoint = begin;
this.endPoint = end;
}
internal override int[] Indices => throw new Exception();
public override Line[] GetAllSides()
{
throw new NotImplementedException();
@@ -66,5 +70,35 @@ namespace StgSharp.Geometries
{
throw new ToUpperDimensionException();
}
/// <summary>
/// Move begin side of a line.
/// It is recommended to override this function rather than
/// loading an <see cref="GetLocationHandler"/> with same function.
/// </summary>
/// <param name="tick">Time passed since current line was created.</param>
public virtual vec3d MoveBeginPoint(uint tick)
{
return movBegin.Invoke(time);
}
/// <summary>
/// Move end side of a line.
/// It is recommended to override this function rather than
/// loading an <see cref="GetLocationHandler"/> with same function.
/// </summary>
/// <param name="tick">Time passed since current line was created.</param>
/// <returns></returns>
public virtual vec3d MoveEndPoint(uint tick)
{
return movEnd.Invoke(time);
}
internal override void UpdateCoordinate(uint tick)
{
beginPoint.Position = coordinate.origin + MoveBeginPoint(time);
endPoint.Position = coordinate.origin + MoveEndPoint(time);
}
}
}
@@ -1,19 +1,46 @@
using StgSharp.Controlling;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Parallelogram.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Controlling;
using StgSharp.Math;
namespace StgSharp.Geometries
{
public class Parallelogram : Polygon4
{
internal Point center;
internal readonly GetLocationHandler movCenterOperation =
new GetLocationHandler(GeometryOperation.DefualtMotion);
public GetLocationHandler MovCenterOperation { get { return movCenterOperation; } }
public GetLocationHandler MovVertex01Operation { get { return moveVertex0Operation; } }
public GetLocationHandler MovVertex02Operation { get { return moveVertex1Operation; } }
public Parallelogram(
float v0x, float v0y, float v0z,
float v1x, float v1y, float v1z,
@@ -35,6 +62,10 @@ namespace StgSharp.Geometries
}
}
public GetLocationHandler MovCenterOperation => movCenterOperation;
public GetLocationHandler MovVertex01Operation => moveVertex0Operation;
public GetLocationHandler MovVertex02Operation => moveVertex1Operation;
public virtual vec3d MovCenter(uint tick)
{
return movCenterOperation.Invoke(tick);
@@ -46,7 +77,7 @@ namespace StgSharp.Geometries
/// <param name="tick">Current time tick</param>
/// <returns></returns>
/// <exception cref="UnusedVertexException">Geometry overdefined</exception>
public sealed override vec3d MoveVertex2(uint tick)
public override sealed vec3d MoveVertex2(uint tick)
{
throw new UnusedVertexException();
}
@@ -57,12 +88,12 @@ namespace StgSharp.Geometries
/// <param name="tick">Current time tick</param>
/// <returns></returns>
/// <exception cref="UnusedVertexException">Geometry overdefined</exception>
public sealed override vec3d MoveVertex3(uint tick)
public override sealed vec3d MoveVertex3(uint tick)
{
throw new UnusedVertexException();
}
internal sealed override void UpdateCoordinate(uint tick)
internal override sealed void UpdateCoordinate(uint tick)
{
}
@@ -1,16 +1,48 @@
using StgSharp.Math;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Plain.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Math;
using System.Numerics;
namespace StgSharp.Geometries
{
public unsafe class Plain
{
internal readonly float d = -1;
internal vec3d origin;
internal vec3d vec1;
internal vec3d vec2;
internal vec3d plainParameter;
internal readonly float d = -1;
internal vec3d vec1;
internal vec3d vec2;
internal Plain(Vector4 origin, Vector4 p1, Vector4 p2)
{
@@ -23,11 +55,11 @@ namespace StgSharp.Geometries
public Plain(vec3d o, vec3d v1, vec3d v2)
{
this.origin = o;
this.vec1 = v1 - v2 * (v1.Y / v2.Y); //计算平面在xz平面上的方向投影
this.vec2 = v2 - vec1 * (v2.X / v1.X); //计算平面在yz平面上的方向投影
this.vec1 = v1 - (v2 * (v1.Y / v2.Y)); //计算平面在xz平面上的方向投影
this.vec2 = v2 - (vec1 * (v2.X / v1.X)); //计算平面在yz平面上的方向投影
//|origin|-k1*|vec1|-k2*|vec2|计算plainParameter.Z;
plainParameter.Z = origin.Z - vec1.Z * (origin.X / vec1.X) - vec2.Z * (origin.Y / vec2.Y);
plainParameter.Z = origin.Z - (vec1.Z * (origin.X / vec1.X)) - (vec2.Z * (origin.Y / vec2.Y));
//根据plainParameter.Z和对应的方向矢量计算plainParameter.X和plainParameter.Y
plainParameter.X = vec1.X * (vec1.Z / plainParameter.Z);
plainParameter.Y = vec2.Y * (vec2.Z / plainParameter.Z);
@@ -44,11 +76,11 @@ namespace StgSharp.Geometries
vec3d v2 = p3.Position - origin;
vec1 = v1 - v2 * (v1.Y / v2.Y); //计算平面在xz平面上的方向投影
vec2 = v2 - vec1 * (v2.X / v1.X); //计算平面在yz平面上的方向投影
vec1 = v1 - (v2 * (v1.Y / v2.Y)); //计算平面在xz平面上的方向投影
vec2 = v2 - (vec1 * (v2.X / v1.X)); //计算平面在yz平面上的方向投影
//|origin|-k1*|vec1|-k2*|vec2|计算plainParameter.Z;
plainParameter.Z = origin.Z - vec1.Z * (origin.X / vec1.X) - vec2.Z * (origin.Y / vec2.Y);
plainParameter.Z = origin.Z - (vec1.Z * (origin.X / vec1.X)) - (vec2.Z * (origin.Y / vec2.Y));
//根据plainParameter.Z和对应的方向矢量计算plainParameter.X和plainParameter.Y
plainParameter.X = vec1.X * (vec1.Z / plainParameter.Z);
plainParameter.Y = vec2.Y * (vec2.Z / plainParameter.Z);
@@ -1,4 +1,34 @@
using StgSharp.Graphics;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="PlainGeometry.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Math;
namespace StgSharp.Geometries
@@ -8,34 +38,25 @@ namespace StgSharp.Geometries
/// </summary>
public abstract class PlainGeometry
{
protected TimeProvider time;
protected TimeSpanProvider time;
internal PartialPlainCoordinate coordinate;
internal Matrix2x4 textureFrame;
public PartialPlainCoordinate ReferenceCoordinate
public PlainGeometry()
{
get => this.coordinate;
}
/// <summary>
/// Tick time this geometry eas crested
/// </summary>
/// </summary>
public uint BornTime => time;
public PartialPlainCoordinate ReferenceCoordinate => this.coordinate;
internal abstract int[] Indices { get; }
public PlainGeometry(Form form)
{
time = new TimeProvider(form);
}
public PlainGeometry()
{ }
internal abstract void UpdateCoordinate(uint tick);
/// <summary>
/// Get all sides of this <see cref="PlainGeometry"/>.
/// </summary>
@@ -48,6 +69,9 @@ namespace StgSharp.Geometries
/// <returns></returns>
public abstract Plain GetPlain();
internal abstract void UpdateCoordinate(uint tick);
//public abstract Rectangle GetRenderFrame();
}
}
@@ -1,4 +1,35 @@
using StgSharp.Math;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Point.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Math;
using System;
using System.Numerics;
using System.Runtime.InteropServices;
@@ -8,10 +39,9 @@ namespace StgSharp.Geometries
{
public unsafe class Point
{
internal vec3d position;
internal readonly bool isVertex;
public Point() { }
internal readonly bool isVertex;
internal vec3d position;
internal Point(vec3d p)
{
@@ -23,47 +53,40 @@ namespace StgSharp.Geometries
position = new vec3d(vector);
}
public Point() { }
public Point(float x, float y, float z)
{
position = new vec3d(x, y, z);
}
public bool IsVertex => isVertex;
public vec3d Position
{
get { return position; }
set { position = value; }
get => position;
set => position = value;
}
public float X
{
get { return position.X; }
set { position.X = value; }
get => position.X;
set => position.X = value;
}
public float Y
{
get { return position.Y; }
set { position.Y = value; }
get => position.Y;
set => position.Y = value;
}
public float Z
{
get { return position.Z; }
set { position.Z = value; }
get => position.Z;
set => position.Z = value;
}
public bool IsVertex => isVertex;
/// <summary>
/// Update the coordinate of the point. If this is a moving point,
/// (Points on sides or surface if other geometry items)
/// please do not define any motion here, codes will be ignored by program
/// </summary>
/// <param name="tick">Time passes since the program begin, counted by frames</param>
public virtual void Update(uint tick) { }
public bool IsInGeometry(PlainGeometry geo)
{
throw new NotImplementedException();
@@ -75,6 +98,15 @@ namespace StgSharp.Geometries
}
/// <summary>
/// Update the coordinate of the point. If this is a moving point,
/// (Points on sides or surface if other geometry items)
/// please do not define any motion here, codes will be ignored by program
/// </summary>
/// <param name="tick">Time passes since the program begin, counted by frames</param>
public virtual void Update(uint tick) { }
}
}
@@ -1,11 +1,43 @@
using StgSharp.Controlling;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Polygon4.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Controlling;
using StgSharp.Math;
using System.Numerics;
namespace StgSharp.Geometries
{
public class Polygon4 : PlainGeometry
{
internal readonly GetLocationHandler moveVertex0Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal readonly GetLocationHandler moveVertex1Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal readonly GetLocationHandler moveVertex2Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
@@ -61,50 +93,39 @@ namespace StgSharp.Geometries
vertexMat.mat.colum3 = new Vector4(v3x, v3y, v3z, 0);
}
public GetLocationHandler MovVertex0Operaion { get { return moveVertex0Operation; } }
public GetLocationHandler MovVertex1Operaion { get { return moveVertex1Operation; } }
public GetLocationHandler MovVertex2Operaion { get { return moveVertex2Operation; } }
public GetLocationHandler MovVertex3Operaion { get { return moveVertex3Operation; } }
internal sealed override int[] Indices
{
get
{
return new int[6] {
0,1,2,
0,2,3};
}
}
public Mat4 VertexBuffer
{
get { return vertexMat.mat; }
}
public GetLocationHandler MovVertex0Operaion => moveVertex0Operation;
public GetLocationHandler MovVertex1Operaion => moveVertex1Operation;
public GetLocationHandler MovVertex2Operaion => moveVertex2Operation;
public GetLocationHandler MovVertex3Operaion => moveVertex3Operation;
public Point Vertex0
{
get => new Point(vertexMat.mat.colum0);
set { vertexMat.mat.colum0 = value.position.vec; }
set => vertexMat.mat.colum0 = value.position.vec;
}
public Point Vertex1
{
get => new Point(vertexMat.mat.colum1);
set { vertexMat.mat.colum1 = value.position.vec; }
set => vertexMat.mat.colum1 = value.position.vec;
}
public Point Vertex2
{
get => new Point(vertexMat.mat.colum2);
set { vertexMat.mat.colum1 = value.position.vec; }
set => vertexMat.mat.colum1 = value.position.vec;
}
public Mat4 VertexBuffer => vertexMat.mat;
internal override sealed int[] Indices => new int[6] { 0, 1, 2, 0, 2, 3 };
internal Point Vertex3
{
get => new Point(vertexMat.mat.colum3);
set { vertexMat.mat.colum1 = value.position.vec; }
set => vertexMat.mat.colum1 = value.position.vec;
}
@@ -131,21 +152,30 @@ namespace StgSharp.Geometries
}
public virtual vec3d MoveVertex0(uint tick)
=> moveVertex0Operation(tick);
{
return moveVertex0Operation(tick);
}
public virtual vec3d MoveVertex1(uint tick)
=> moveVertex1Operation(tick);
{
return moveVertex1Operation(tick);
}
public virtual vec3d MoveVertex2(uint tick)
=> moveVertex2Operation(tick);
{
return moveVertex2Operation(tick);
}
public virtual vec3d MoveVertex3(uint tick)
=> moveVertex3Operation(tick);
{
return moveVertex3Operation(tick);
}
internal override void UpdateCoordinate(uint tick)
{
}
}
}
@@ -1,12 +1,44 @@
using StgSharp.Controlling;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Polygon5.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Controlling;
using StgSharp.Math;
using StgSharp.Math.Linear;
using System.Numerics;
namespace StgSharp.Geometries
{
public unsafe class Polygon5 : PlainGeometry
{
internal Point _refOrigin;
internal GetLocationHandler movP01Operation = default;
internal GetLocationHandler movP02Operation = default;
@@ -35,57 +67,46 @@ namespace StgSharp.Geometries
}
public GetLocationHandler MovP01Operation { get => movP01Operation; }
public GetLocationHandler MovP02Operation { get => movP02Operation; }
public GetLocationHandler MovP03Operation { get => movP03Operation; }
public GetLocationHandler MovP04Operation { get => movP04Operation; }
public GetLocationHandler MovP05Operation { get => movP05Operation; }
public mat5 VertexBuffer
{
get { return vertexMat; }
}
public GetLocationHandler MovP01Operation => movP01Operation;
public GetLocationHandler MovP02Operation => movP02Operation;
public GetLocationHandler MovP03Operation => movP03Operation;
public GetLocationHandler MovP04Operation => movP04Operation;
public GetLocationHandler MovP05Operation => movP05Operation;
public Point Vertex0
{
get => new Point(vertexMat.vec0);
set { vertexMat.vec0 = value.position.vec; }
set => vertexMat.vec0 = value.position.vec;
}
public Point Vertex1
{
get => new Point(vertexMat.vec1);
set { vertexMat.vec1 = value.position.vec; }
set => vertexMat.vec1 = value.position.vec;
}
public Point Vertex2
{
get => new Point(vertexMat.vec2);
set { vertexMat.vec2 = value.position.vec; }
set => vertexMat.vec2 = value.position.vec;
}
public Point Vertex3
{
get => new Point(vertexMat.vec3);
set { vertexMat.vec3 = value.position.vec; }
set => vertexMat.vec3 = value.position.vec;
}
public Point Vertex4
{
get => new Point(vertexMat.vec4);
set { vertexMat.vec4 = value.position.vec; }
set => vertexMat.vec4 = value.position.vec;
}
internal override int[] Indices
{
get
{
return new int[9]{
0,1,2,
0,2,3,
0,3,4};
}
}
public mat5 VertexBuffer => vertexMat;
internal override int[] Indices => new int[9] { 0, 1, 2, 0, 2, 3, 0, 3, 4 };
public override Line[] GetAllSides()
{
return new Line[5]
@@ -103,15 +124,30 @@ namespace StgSharp.Geometries
return new Plain(Vertex0, Vertex1, Vertex2);
}
public virtual vec3d movVertex01(uint tick) => movP01Operation.Invoke(time);
public virtual vec3d movVertex01(uint tick)
{
return movP01Operation.Invoke(time);
}
public virtual vec3d movVertex02(uint tick) => movP02Operation.Invoke(time);
public virtual vec3d movVertex02(uint tick)
{
return movP02Operation.Invoke(time);
}
public virtual vec3d movVertex03(uint tick) => movP03Operation.Invoke(time);
public virtual vec3d movVertex03(uint tick)
{
return movP03Operation.Invoke(time);
}
public virtual vec3d movVertex04(uint tick) => movP04Operation.Invoke(time);
public virtual vec3d movVertex04(uint tick)
{
return movP04Operation.Invoke(time);
}
public virtual vec3d movVertex05(uint tick) => movP05Operation.Invoke(time);
public virtual vec3d movVertex05(uint tick)
{
return movP05Operation.Invoke(time);
}
internal override void UpdateCoordinate(uint tick)
@@ -123,5 +159,6 @@ namespace StgSharp.Geometries
vertexMat.vec3 = (coordinate.origin + movVertex04(nowTick)).vec;
vertexMat.vec4 = (coordinate.origin + movVertex05(nowTick)).vec;
}
}
}
@@ -1,4 +1,34 @@
using StgSharp.Controlling;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Polygon6.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Controlling;
using StgSharp.Math;
using StgSharp.Math.Linear;
@@ -8,6 +38,7 @@ namespace StgSharp.Geometries
{
public class Polygon6 : PlainGeometry
{
internal Point _refOrigin;
internal GetLocationHandler movVertex0Operation;
internal GetLocationHandler movVertex1Operation;
@@ -17,61 +48,51 @@ namespace StgSharp.Geometries
internal GetLocationHandler movVertex5Operation;
internal mat6 vertexMat;
public GetLocationHandler MovVertex0Operation { get => movVertex0Operation; }
public GetLocationHandler MovVertex1Operation { get => movVertex1Operation; }
public GetLocationHandler MovVertex2Operation { get => movVertex2Operation; }
public GetLocationHandler MovVertex3Operation { get => movVertex3Operation; }
public GetLocationHandler MovVertex4Operation { get => movVertex4Operation; }
public GetLocationHandler MovVertex5Operation { get => movVertex5Operation; }
internal override int[] Indices
{
get
{
return new int[12] {
0,1,2,
0,2,3,
0,3,4,
0,4,5};
}
}
public GetLocationHandler MovVertex0Operation => movVertex0Operation;
public GetLocationHandler MovVertex1Operation => movVertex1Operation;
public GetLocationHandler MovVertex2Operation => movVertex2Operation;
public GetLocationHandler MovVertex3Operation => movVertex3Operation;
public GetLocationHandler MovVertex4Operation => movVertex4Operation;
public GetLocationHandler MovVertex5Operation => movVertex5Operation;
public Point Vertex0
{
get => new Point(vertexMat.vec0);
set { vertexMat.vec0 = value.position.vec; }
set => vertexMat.vec0 = value.position.vec;
}
public Point Vertex1
{
get => new Point(vertexMat.vec1);
set { vertexMat.vec1 = value.position.vec; }
set => vertexMat.vec1 = value.position.vec;
}
public Point Vertex2
{
get => new Point(vertexMat.vec2);
set { vertexMat.vec2 = value.position.vec; }
set => vertexMat.vec2 = value.position.vec;
}
public Point Vertex3
{
get => new Point(vertexMat.vec3);
set { vertexMat.vec3 = value.position.vec; }
set => vertexMat.vec3 = value.position.vec;
}
public Point Vertex4
{
get => new Point(vertexMat.vec4);
set { vertexMat.vec4 = value.position.vec; }
set => vertexMat.vec4 = value.position.vec;
}
public Point Vertex5
{
get => new Point(vertexMat.vec5);
set { vertexMat.vec5 = value.position.vec; }
set => vertexMat.vec5 = value.position.vec;
}
internal override int[] Indices => new int[12] { 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5 };
public override Line[] GetAllSides()
{
return new Line[6]
@@ -131,5 +152,6 @@ namespace StgSharp.Geometries
vertexMat.vec4 = origin + movVertex4(nowTick).vec;
vertexMat.vec5 = origin + movVertex5(nowTick).vec;
}
}
}
@@ -1,10 +1,42 @@
using StgSharp.Math;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Rectangle.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Math;
using System.Numerics;
namespace StgSharp.Geometries
{
public class Rectangle : Parallelogram
{
public Rectangle(
float v0x, float v0y, float v0z,
float v1x, float v1y, float v1z,
@@ -30,7 +62,10 @@ namespace StgSharp.Geometries
/// </summary>
/// <param name="tick">当前游戏刻</param>
/// <returns></returns>
public virtual vec3d MovCenter(uint tick) => default(vec3d);
public virtual vec3d MovCenter(uint tick)
{
return default(vec3d);
}
@@ -1,4 +1,35 @@
using StgSharp.Math;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Square.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Math;
using System.Numerics;
namespace StgSharp.Geometries
@@ -9,6 +40,7 @@ namespace StgSharp.Geometries
/// </summary>
public class Square : Rectangle
{
public Square(
float v0x, float v0y, float v0z,
float v1x, float v1y, float v1z,
@@ -21,7 +53,7 @@ namespace StgSharp.Geometries
{
}
public sealed override vec3d MoveVertex1(uint tick)
public override sealed vec3d MoveVertex1(uint tick)
{
return default;
}
@@ -1,5 +1,36 @@
using StgSharp.Controlling;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Triangle.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Controlling;
using StgSharp.Math;
using System.Numerics;
namespace StgSharp.Geometries
@@ -46,15 +77,9 @@ namespace StgSharp.Geometries
public GetLocationHandler MovVertex02Operation => this.movVertex02Opearion;
public GetLocationHandler MovVertex03Operation => this.movVertex03Opearion;
public Mat3 VertexBuffer
{
get { return vertexMat.mat; }
}
public Mat3 VertexBuffer => vertexMat.mat;
internal sealed override int[] Indices
{
get { return new int[3] { 0, 1, 2 }; }
}
internal override sealed int[] Indices => new int[3] { 0, 1, 2 };
public override Line[] GetAllSides()
{
@@ -73,18 +98,28 @@ namespace StgSharp.Geometries
return new Plain(this.vertexMat.mat.colum0, this.vertexMat.mat.colum1, this.vertexMat.mat.colum2);
}
public virtual vec3d MovVertex01(uint tick) => movVertex01Opearion.Invoke(tick);
public virtual vec3d MovVertex01(uint tick)
{
return movVertex01Opearion.Invoke(tick);
}
public virtual vec3d MovVertex02(uint tick) => movVertex02Opearion.Invoke(tick);
public virtual vec3d MovVertex02(uint tick)
{
return movVertex02Opearion.Invoke(tick);
}
public virtual vec3d MovVertex03(uint tick) => movVertex03Opearion.Invoke(tick);
public virtual vec3d MovVertex03(uint tick)
{
return movVertex03Opearion.Invoke(tick);
}
internal sealed override void UpdateCoordinate(uint tick)
internal override sealed void UpdateCoordinate(uint tick)
{
tick = time;
vertexMat.mat.colum0 = coordinate.origin.vec + MovVertex01(time).vec;
vertexMat.mat.colum1 = coordinate.origin.vec + MovVertex02(time).vec;
vertexMat.mat.colum2 = coordinate.origin.vec + MovVertex03(time).vec;
}
}
}
@@ -1,4 +1,34 @@
using System;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Class1.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;