2nd update on 20230415 by nitload youmu
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -12,17 +12,18 @@ namespace StgSharp.Control
|
|||||||
GameTimeLine.allPool.Add(pool);
|
GameTimeLine.allPool.Add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GeometryCombination(IGeometryCombination geometry)
|
public static void GeometryCombination(IPlainGeometryCombination geometry)
|
||||||
{
|
{
|
||||||
foreach (IGeometry geo in geometry)
|
foreach (IPlainGeometry geo in geometry)
|
||||||
{
|
{
|
||||||
GameTimeLine._currentPool.geometryContainer.Add(geo);
|
GameTimeLine._currentPool.geometryContainer.Add(geo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Geometry(IGeometry geometry)
|
public static void Geometry(IPlainGeometry geometry)
|
||||||
{
|
{
|
||||||
GameTimeLine._currentPool.geometryContainer.Add(geometry);
|
GameTimeLine._currentPool.geometryContainer.Add(geometry);
|
||||||
|
GameTimeLine._currentPool.pointContainer.Add(geometry.RefPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ namespace StgSharp
|
|||||||
public abstract class IEntity:INode<IEntity>
|
public abstract class IEntity:INode<IEntity>
|
||||||
{
|
{
|
||||||
internal Point _pos;
|
internal Point _pos;
|
||||||
internal LinkedList<IGeometry> _collisionBox;
|
internal LinkedList<IPlainGeometry> _collisionBox;
|
||||||
internal Sensor<IGeometry> _collisionSensor;
|
internal Sensor<IPlainGeometry> _collisionSensor;
|
||||||
internal string _texture;
|
internal string _texture;
|
||||||
internal Point _position;
|
internal Point _position;
|
||||||
internal Point _basePoint;
|
internal Point _basePoint;
|
||||||
internal GetLocationHandler _movHandler;
|
internal GetLocationHandler _movHandler;
|
||||||
protected uint _bornTick;
|
protected uint _bornTick;
|
||||||
|
|
||||||
public LinkedList<IGeometry> CollisionBox
|
public LinkedList<IPlainGeometry> CollisionBox
|
||||||
{
|
{
|
||||||
get { return _collisionBox; }
|
get { return _collisionBox; }
|
||||||
set { _collisionBox = value; }
|
set { _collisionBox = value; }
|
||||||
@@ -26,7 +26,7 @@ namespace StgSharp
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A sensor used for cheking out if a bullet hit a player or something else
|
/// A sensor used for cheking out if a bullet hit a player or something else
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Sensor<IGeometry> CollisionSensor
|
public Sensor<IPlainGeometry> CollisionSensor
|
||||||
{
|
{
|
||||||
get { return _collisionSensor; }
|
get { return _collisionSensor; }
|
||||||
set { _collisionSensor = value; }
|
set { _collisionSensor = value; }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Arc : IGeometry
|
public class Arc : IPlainGeometry
|
||||||
{
|
{
|
||||||
internal Point _basePoint;
|
internal Point _basePoint;
|
||||||
internal Point _center;
|
internal Point _center;
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
using StgSharp.Math;
|
using StgSharp.Linear;
|
||||||
|
using StgSharp.Math;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Circle : IGeometry
|
public class Circle : IPlainGeometry
|
||||||
{
|
{
|
||||||
internal Point _baseCenter;
|
internal Point _baseCenter;
|
||||||
internal Point _center;
|
internal Point _center;
|
||||||
internal Point _radiusVec;
|
internal Point _pointOnCircle;
|
||||||
|
internal Point _pointOnPlain;
|
||||||
internal RenderMode _renderMode;
|
internal RenderMode _renderMode;
|
||||||
internal readonly uint bornTick;
|
internal readonly uint bornTick;
|
||||||
|
|
||||||
@@ -17,9 +19,9 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
public override Point RefPoint => _center;
|
public override Point RefPoint => _center;
|
||||||
|
|
||||||
public override Point RefVec01 => _radiusVec;
|
public override Point RefVec01 => _pointOnCircle;
|
||||||
|
|
||||||
public override Point RefVec02 => default;
|
public override Point RefVec02 => _pointOnPlain;
|
||||||
|
|
||||||
public override RenderMode renderMode => _renderMode;
|
public override RenderMode renderMode => _renderMode;
|
||||||
|
|
||||||
@@ -40,19 +42,19 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
internal override void CalcVec02(vec3d vec, uint tick)
|
internal override void CalcVec02(vec3d vec, uint tick)
|
||||||
{
|
{
|
||||||
_radiusVec._position = vec + UpdateRadius(tick);
|
_pointOnCircle._position = vec + UpdateRadius(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override void CalcVec03(vec3d vec, uint tick)
|
internal override void CalcVec03(vec3d vec, uint tick)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_pointOnPlain._position = vec + UpdatePlain(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual vec3d MoveCenter(uint tick) => default;
|
public virtual vec3d MoveCenter(uint tick) => default;
|
||||||
|
|
||||||
public virtual vec3d UpdateRadius(uint tick) => default;
|
public virtual vec3d UpdateRadius(uint tick) => default;
|
||||||
|
|
||||||
|
public virtual vec3d UpdatePlain(uint tick) => default;
|
||||||
|
|
||||||
public override float SetArrayX()
|
public override float SetArrayX()
|
||||||
{
|
{
|
||||||
@@ -64,6 +66,11 @@ namespace StgSharp.Geometries
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Plain GetPlain()
|
||||||
|
{
|
||||||
|
return new Plain(_center,_pointOnCircle,_pointOnPlain);
|
||||||
|
}
|
||||||
|
|
||||||
internal override void OnRender(uint tick)
|
internal override void OnRender(uint tick)
|
||||||
{
|
{
|
||||||
tick-=bornTick;
|
tick-=bornTick;
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
|
||||||
{
|
|
||||||
public static unsafe class GeometryCalc
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
using StgSharp.Math;
|
using StgSharp.Linear;
|
||||||
|
using StgSharp.Math;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public abstract class IGeometry:INode<IGeometry>
|
public abstract class IPlainGeometry:INode<IPlainGeometry>
|
||||||
{
|
{
|
||||||
private readonly uint bornTick;
|
private readonly uint bornTick;
|
||||||
|
|
||||||
@@ -15,17 +16,17 @@ namespace StgSharp.Geometries
|
|||||||
public abstract Point RefVec02{ get; }
|
public abstract Point RefVec02{ get; }
|
||||||
public uint BornTime => bornTick;
|
public uint BornTime => bornTick;
|
||||||
|
|
||||||
public IGeometry(uint bornTime)
|
public IPlainGeometry(uint bornTime)
|
||||||
{
|
{
|
||||||
bornTick=bornTime;
|
bornTick=bornTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGeometry(Counter<uint> MainTimer)
|
public IPlainGeometry(Counter<uint> MainTimer)
|
||||||
{
|
{
|
||||||
bornTick = MainTimer.Value;
|
bornTick = MainTimer.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGeometry() { }
|
public IPlainGeometry() { }
|
||||||
|
|
||||||
internal abstract void CalcVec01(uint tick);
|
internal abstract void CalcVec01(uint tick);
|
||||||
internal abstract void CalcVec02(vec3d vec, uint tick);
|
internal abstract void CalcVec02(vec3d vec, uint tick);
|
||||||
@@ -38,6 +39,8 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
public abstract Line[] GetAllSides();
|
public abstract Line[] GetAllSides();
|
||||||
|
|
||||||
|
public abstract Plain GetPlain();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
+4
-4
@@ -4,23 +4,23 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public abstract class IGeometryCombination:LinkedList<IGeometry>
|
public abstract class IPlainGeometryCombination:LinkedList<IPlainGeometry>
|
||||||
{
|
{
|
||||||
internal readonly uint _bornTick;
|
internal readonly uint _bornTick;
|
||||||
|
|
||||||
internal abstract void toSimpleGeometry();
|
internal abstract void toSimpleGeometry();
|
||||||
|
|
||||||
public IGeometryCombination(uint bornTime)
|
public IPlainGeometryCombination(uint bornTime)
|
||||||
{
|
{
|
||||||
_bornTick = bornTime;
|
_bornTick = bornTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGeometryCombination(Counter<uint> timer)
|
public IPlainGeometryCombination(Counter<uint> timer)
|
||||||
{
|
{
|
||||||
_bornTick = timer._value;
|
_bornTick = timer._value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGeometryCombination()
|
public IPlainGeometryCombination()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Line:IGeometry
|
public class Line:IPlainGeometry
|
||||||
{
|
{
|
||||||
internal Point _basePoint = default ;
|
internal Point _basePoint = default ;
|
||||||
internal Point _beginPoint = default ;
|
internal Point _beginPoint = default ;
|
||||||
|
|||||||
@@ -6,21 +6,21 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
internal class Parallelogram : IGeometry
|
internal class Parallelogram : IPlainGeometry
|
||||||
{
|
{
|
||||||
internal Point _basePoint;
|
internal Point _basePoint;
|
||||||
internal Point _center;
|
internal Point _center;
|
||||||
internal Point _corner1;
|
internal Point _vertex1;
|
||||||
internal Point _corner2;
|
internal Point _vertex2;
|
||||||
internal RenderMode _renderMode;
|
internal RenderMode _renderMode;
|
||||||
internal readonly uint bornTick;
|
internal readonly uint bornTick;
|
||||||
|
|
||||||
public override sealed Point BasePoint => _basePoint;
|
public override sealed Point BasePoint => _basePoint;
|
||||||
public override sealed Point RefPoint => _center;
|
public override sealed Point RefPoint => _center;
|
||||||
|
|
||||||
public override sealed Point RefVec01 => _corner1;
|
public override sealed Point RefVec01 => _vertex1;
|
||||||
|
|
||||||
public override sealed Point RefVec02 => _corner2;
|
public override sealed Point RefVec02 => _vertex2;
|
||||||
|
|
||||||
public override RenderMode renderMode => _renderMode;
|
public override RenderMode renderMode => _renderMode;
|
||||||
|
|
||||||
@@ -72,13 +72,13 @@ namespace StgSharp.Geometries
|
|||||||
//计算第一个顶点的位移,存在相对中心位移和相对参考原点位移两种模式
|
//计算第一个顶点的位移,存在相对中心位移和相对参考原点位移两种模式
|
||||||
internal override void CalcVec02(vec3d vec, uint tick)
|
internal override void CalcVec02(vec3d vec, uint tick)
|
||||||
{
|
{
|
||||||
_corner1._position = vec + UpdateCTC1(tick);
|
_vertex1._position = vec + UpdateCTC1(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
//计算第二个顶点的位移,存在相对中心位移和相对参考原点位移两种模式
|
//计算第二个顶点的位移,存在相对中心位移和相对参考原点位移两种模式
|
||||||
internal override void CalcVec03(vec3d vec, uint tick)
|
internal override void CalcVec03(vec3d vec, uint tick)
|
||||||
{
|
{
|
||||||
_corner2._position = vec + UpdateCTC2(tick);
|
_vertex2._position = vec + UpdateCTC2(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual vec3d MovCenter(uint tick) => default(vec3d);
|
public virtual vec3d MovCenter(uint tick) => default(vec3d);
|
||||||
@@ -87,10 +87,14 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
public virtual vec3d UpdateCTC2(uint tick) => default(vec3d);
|
public virtual vec3d UpdateCTC2(uint tick) => default(vec3d);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取平行四边形的全部边
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public override Line[] GetAllSides()
|
public override Line[] GetAllSides()
|
||||||
{
|
{
|
||||||
|
|
||||||
Line[] lines = new Line[4]
|
Line[] sides = new Line[4]
|
||||||
{
|
{
|
||||||
new Line(GameTimeLine.tickCounter),
|
new Line(GameTimeLine.tickCounter),
|
||||||
new Line(GameTimeLine.tickCounter),
|
new Line(GameTimeLine.tickCounter),
|
||||||
@@ -99,42 +103,36 @@ namespace StgSharp.Geometries
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
lines[0]._basePoint = this._corner1;
|
sides[0]._basePoint = this._vertex1;
|
||||||
lines[0]._beginPoint = this._corner1;
|
sides[0]._beginPoint = this._vertex1;
|
||||||
lines[0]._endPoint = this._corner2;
|
sides[0]._endPoint = this._vertex2;
|
||||||
|
|
||||||
lines[1]._basePoint = this._corner2;
|
sides[1]._basePoint = this._vertex2;
|
||||||
lines[1]._beginPoint = this._corner2;
|
sides[1]._beginPoint = this._vertex2;
|
||||||
lines[1]._endPoint = new Point() { _position = getCorner3(GameTimeLine.tickCounter)};
|
sides[1]._endPoint = new Point() { _position = GetVertex3(GameTimeLine.tickCounter)};
|
||||||
lines[1].movEnd += this.getCorner3;
|
sides[1].movEnd += this.GetVertex3;
|
||||||
|
|
||||||
lines[2]._basePoint = lines[1]._endPoint;
|
sides[2]._basePoint = sides[1]._endPoint;
|
||||||
lines[2]._beginPoint = lines[2]._basePoint;
|
sides[2]._beginPoint = sides[2]._basePoint;
|
||||||
lines[2]._endPoint = new Point() { _position = this.getCorner4(GameTimeLine.tickCounter) };
|
sides[2]._endPoint = new Point() { _position = this.GetVertex4(GameTimeLine.tickCounter) };
|
||||||
lines[2].movEnd+= this.getCorner4;
|
sides[2].movEnd+= this.GetVertex4;
|
||||||
|
|
||||||
lines[3]._beginPoint = lines[2]._endPoint;
|
sides[3]._beginPoint = sides[2]._endPoint;
|
||||||
lines[3]._endPoint = this._corner1;
|
sides[3]._endPoint = this._vertex1;
|
||||||
|
|
||||||
return lines;
|
return sides;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected vec3d getCorner1(Counter<uint> tick)
|
|
||||||
|
protected vec3d GetVertex3(Counter<uint> tick)
|
||||||
{
|
{
|
||||||
return this._corner1._position;
|
return 2 * this._center._position - this._vertex1._position;
|
||||||
}
|
|
||||||
protected vec3d getCorner2(Counter<uint> tick)
|
|
||||||
{
|
|
||||||
return this._corner2._position;
|
|
||||||
}
|
|
||||||
protected vec3d getCorner3(Counter<uint> tick)
|
|
||||||
{
|
|
||||||
return 2 * this._center._position - this._corner1._position;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected vec3d getCorner4(Counter<uint> tick)
|
protected vec3d GetVertex4(Counter<uint> tick)
|
||||||
{
|
{
|
||||||
return 2 * this._center._position - this._corner2._position;
|
return 2 * this._center._position - this._vertex2._position;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,11 +26,20 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
public void Update() => new NotImplementedException();
|
public void Update() => new NotImplementedException();
|
||||||
|
|
||||||
public static void CoordsAdd(Point p1, Point p2)
|
public bool IsInGeometry(IPlainGeometry geo)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsInGeometry(IPlainGeometryCombination geo)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsInPlain(IPlainGeometry geo)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Polygon : IGeometryCombination
|
public class Polygon : IPlainGeometryCombination
|
||||||
{
|
{
|
||||||
internal Point[] pointsArray;
|
internal Point[] pointsArray;
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,27 @@
|
|||||||
using StgSharp.Math;
|
using StgSharp.Control;
|
||||||
|
using StgSharp.Linear;
|
||||||
|
using StgSharp.Math;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Rectangle : IGeometry
|
public class Rectangle : IPlainGeometry
|
||||||
{
|
{
|
||||||
internal Point _basePoint;
|
internal Point _basePoint;
|
||||||
internal Point _center;
|
internal Point _center;
|
||||||
internal Point _centerToCorner1;
|
internal Point _vertex1;
|
||||||
internal Point _centerToCorner2;
|
internal Point _vertex2;
|
||||||
internal RenderMode _renderMode;
|
internal RenderMode _renderMode;
|
||||||
internal readonly uint bornTick;
|
internal readonly uint bornTick;
|
||||||
|
|
||||||
public override sealed Point BasePoint => _basePoint;
|
public override sealed Point BasePoint => _basePoint;
|
||||||
public override sealed Point RefPoint=>_center;
|
public override sealed Point RefPoint=>_center;
|
||||||
|
|
||||||
public override sealed Point RefVec01 => _centerToCorner1;
|
public override sealed Point RefVec01 => _vertex1;
|
||||||
|
|
||||||
public override sealed Point RefVec02 => _centerToCorner2;
|
public override sealed Point RefVec02 => _vertex2;
|
||||||
|
|
||||||
public override RenderMode renderMode => _renderMode;
|
public override RenderMode renderMode => _renderMode;
|
||||||
|
|
||||||
@@ -75,7 +77,7 @@ namespace StgSharp.Geometries
|
|||||||
/// <param name="tick">当前游戏刻</param>
|
/// <param name="tick">当前游戏刻</param>
|
||||||
internal override void CalcVec02(vec3d vec, uint tick)
|
internal override void CalcVec02(vec3d vec, uint tick)
|
||||||
{
|
{
|
||||||
_centerToCorner1._position = vec + UpdateCTC1(tick);
|
_vertex1._position = vec + UpdateCTC1(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -87,9 +89,9 @@ namespace StgSharp.Geometries
|
|||||||
/// <exception cref="ArgumentException">计算出的第二条对角线长与第一条不相等</exception>
|
/// <exception cref="ArgumentException">计算出的第二条对角线长与第一条不相等</exception>
|
||||||
internal override void CalcVec03(vec3d vec, uint tick)
|
internal override void CalcVec03(vec3d vec, uint tick)
|
||||||
{
|
{
|
||||||
_centerToCorner2._position = vec + UpdateCTC2(tick);
|
_vertex2._position = vec + UpdateCTC2(tick);
|
||||||
if (_centerToCorner1._position.GetLength()
|
if (_vertex1._position.GetLength()
|
||||||
== _centerToCorner2._position.GetLength())
|
== _vertex2._position.GetLength())
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Cannot form a triangle, " +
|
throw new ArgumentException("Cannot form a triangle, " +
|
||||||
"two crossing lines are not equal!");
|
"two crossing lines are not equal!");
|
||||||
@@ -114,7 +116,49 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
public override Line[] GetAllSides()
|
public override Line[] GetAllSides()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
|
Line[] sides = new Line[4]
|
||||||
|
{
|
||||||
|
new Line(GameTimeLine.tickCounter),
|
||||||
|
new Line(GameTimeLine.tickCounter),
|
||||||
|
new Line(GameTimeLine.tickCounter),
|
||||||
|
new Line(GameTimeLine.tickCounter),
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sides[0]._basePoint = this._vertex1;
|
||||||
|
sides[0]._beginPoint = this._vertex1;
|
||||||
|
sides[0]._endPoint = this._vertex2;
|
||||||
|
|
||||||
|
sides[1]._basePoint = this._vertex2;
|
||||||
|
sides[1]._beginPoint = this._vertex2;
|
||||||
|
sides[1]._endPoint = new Point() { _position = GetVertex3(GameTimeLine.tickCounter) };
|
||||||
|
sides[1].movEnd += this.GetVertex3;
|
||||||
|
|
||||||
|
sides[2]._basePoint = sides[1]._endPoint;
|
||||||
|
sides[2]._beginPoint = sides[2]._basePoint;
|
||||||
|
sides[2]._endPoint = new Point() { _position = this.GetVertex4(GameTimeLine.tickCounter) };
|
||||||
|
sides[2].movEnd += this.GetVertex4;
|
||||||
|
|
||||||
|
sides[3]._beginPoint = sides[2]._endPoint;
|
||||||
|
sides[3]._endPoint = this._vertex1;
|
||||||
|
|
||||||
|
return sides;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Plain GetPlain()
|
||||||
|
{
|
||||||
|
return new Plain(_vertex1._position, );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected vec3d GetVertex3(Counter<uint> tick)
|
||||||
|
{
|
||||||
|
return 2 * this._center._position - this._vertex1._position;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected vec3d GetVertex4(Counter<uint> tick)
|
||||||
|
{
|
||||||
|
return 2 * this._center._position - this._vertex2._position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace StgSharp.Geometries
|
||||||
|
{
|
||||||
|
public unsafe class ToUpperDimensionException : Exception
|
||||||
|
{
|
||||||
|
public ToUpperDimensionException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ToUpperDimensionException(string message) : base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ToUpperDimensionException(string message, Exception innerException) : base(message, innerException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ToUpperDimensionException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,22 +7,22 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Triangle :IGeometry
|
public class Triangle :IPlainGeometry
|
||||||
{
|
{
|
||||||
internal Point _basePoint;
|
internal Point _basePoint;
|
||||||
internal Point _beginPoint;
|
internal Point _vertex1;
|
||||||
internal Point _line1;
|
internal Point _vertex2;
|
||||||
internal Point _line2;
|
internal Point _vertex3;
|
||||||
internal RenderMode _renderMode;
|
internal RenderMode _renderMode;
|
||||||
internal readonly uint bornTick;
|
internal readonly uint bornTick;
|
||||||
|
|
||||||
public override sealed Point BasePoint => _basePoint;
|
public override sealed Point BasePoint => _basePoint;
|
||||||
|
|
||||||
public override sealed Point RefPoint=>_beginPoint;
|
public override sealed Point RefPoint=>_vertex1;
|
||||||
|
|
||||||
public override sealed Point RefVec01 => _line1;
|
public override sealed Point RefVec01 => _vertex2;
|
||||||
|
|
||||||
public override sealed Point RefVec02 => _line2;
|
public override sealed Point RefVec02 => _vertex3;
|
||||||
|
|
||||||
public override RenderMode renderMode => _renderMode;
|
public override RenderMode renderMode => _renderMode;
|
||||||
|
|
||||||
@@ -38,17 +38,17 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
internal override void CalcVec01(uint tick)
|
internal override void CalcVec01(uint tick)
|
||||||
{
|
{
|
||||||
_beginPoint._position = _basePoint._position+ MovBegin(tick);
|
_vertex1._position = _basePoint._position+ MovBegin(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override void CalcVec02(vec3d vec, uint tick)
|
internal override void CalcVec02(vec3d vec, uint tick)
|
||||||
{
|
{
|
||||||
_line1._position = vec + CalcSide1(tick);
|
_vertex2._position = vec + CalcSide1(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override void CalcVec03(vec3d vec, uint tick)
|
internal override void CalcVec03(vec3d vec, uint tick)
|
||||||
{
|
{
|
||||||
_line2._position = vec + CalcSide2(tick);
|
_vertex3._position = vec + CalcSide2(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual vec3d MovBegin(uint tick) => default(vec3d);
|
public virtual vec3d MovBegin(uint tick) => default(vec3d);
|
||||||
@@ -67,8 +67,8 @@ namespace StgSharp.Geometries
|
|||||||
CalcVec03(BasePoint._position,tick);
|
CalcVec03(BasePoint._position,tick);
|
||||||
break;
|
break;
|
||||||
case RenderMode.RefPoint:
|
case RenderMode.RefPoint:
|
||||||
CalcVec02(_beginPoint._position,tick);
|
CalcVec02(_vertex1._position,tick);
|
||||||
CalcVec03(_beginPoint._position,tick);
|
CalcVec03(_vertex1._position,tick);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -84,5 +84,24 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Line[] GetAllSides()
|
||||||
|
{
|
||||||
|
Line[] sides = new Line[3];
|
||||||
|
|
||||||
|
sides[0]._beginPoint = _vertex1;
|
||||||
|
sides[0]._basePoint = _vertex1;
|
||||||
|
sides[0]._endPoint = _vertex2;
|
||||||
|
|
||||||
|
sides[1]._basePoint = _vertex2;
|
||||||
|
sides[1]._beginPoint = _vertex2;
|
||||||
|
sides[1]._endPoint = _vertex3;
|
||||||
|
|
||||||
|
sides[2]._basePoint = _vertex3;
|
||||||
|
sides[2]._beginPoint = _vertex3;
|
||||||
|
sides[2]._endPoint = _vertex1;
|
||||||
|
|
||||||
|
return sides;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Math
|
namespace StgSharp.Math
|
||||||
{
|
{
|
||||||
|
|
||||||
internal class Cordination
|
internal class Cordination
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using StgSharp.Geometries;
|
||||||
|
using StgSharp.Math;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace StgSharp.Linear
|
||||||
|
{
|
||||||
|
public unsafe class Plain
|
||||||
|
{
|
||||||
|
internal vec3d vec1;
|
||||||
|
internal vec3d vec2;
|
||||||
|
|
||||||
|
internal float a;
|
||||||
|
internal float b;
|
||||||
|
internal float c;
|
||||||
|
internal readonly float d = -1 ;
|
||||||
|
|
||||||
|
public Plain(vec3d origin, vec3d v1, vec3d v2)
|
||||||
|
{
|
||||||
|
vec1 = v1 - v2 * (v1.Y/v2.Y); //计算平面在xz平面上的方向投影
|
||||||
|
vec2 = v2 - vec1 * (v2.X/v1.X); //计算平面在yz平面上的方向投影
|
||||||
|
|
||||||
|
//|origin|-k1*|vec1|-k2*|vec2|计算c;
|
||||||
|
c = origin.Z - vec1.Z * (origin.X / vec1.X) - vec2.Z * (origin.Y / vec2.Y);
|
||||||
|
//根据c和对应的方向矢量计算a和b
|
||||||
|
a = vec1.X * (vec1.Z / c);
|
||||||
|
b = vec2.Y * (vec2.Z / c);
|
||||||
|
|
||||||
|
a = 1 / a;
|
||||||
|
b = 1 / b;
|
||||||
|
c = 1 / c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plain(Point p1, Point p2, Point p3)
|
||||||
|
{
|
||||||
|
vec3d origin = p1._position;
|
||||||
|
vec3d v1 = p2._position - origin;
|
||||||
|
vec3d v2 = p3._position - origin;
|
||||||
|
|
||||||
|
|
||||||
|
vec1 = v1 - v2 * (v1.Y / v2.Y); //计算平面在xz平面上的方向投影
|
||||||
|
vec2 = v2 - vec1 * (v2.X / v1.X); //计算平面在yz平面上的方向投影
|
||||||
|
|
||||||
|
//|origin|-k1*|vec1|-k2*|vec2|计算c;
|
||||||
|
c = origin.Z - vec1.Z * (origin.X / vec1.X) - vec2.Z * (origin.Y / vec2.Y);
|
||||||
|
//根据c和对应的方向矢量计算a和b
|
||||||
|
a = vec1.X * (vec1.Z / c);
|
||||||
|
b = vec2.Y * (vec2.Z / c);
|
||||||
|
|
||||||
|
a = 1 / a;
|
||||||
|
b = 1 / b;
|
||||||
|
c = 1 / c;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ namespace StgSharp
|
|||||||
public class Pool:INode<Pool>
|
public class Pool:INode<Pool>
|
||||||
{
|
{
|
||||||
internal LinkedList<Point> pointContainer;
|
internal LinkedList<Point> pointContainer;
|
||||||
internal LinkedList<IGeometry> geometryContainer;
|
internal LinkedList<IPlainGeometry> geometryContainer;
|
||||||
internal LinkedList<IEntity> _bulletContainer;
|
internal LinkedList<IEntity> _bulletContainer;
|
||||||
internal LinkedList<IEntity> _awardContainer;
|
internal LinkedList<IEntity> _awardContainer;
|
||||||
internal LinkedList<IEntity> _enemyContainer;
|
internal LinkedList<IEntity> _enemyContainer;
|
||||||
|
|||||||
@@ -8,21 +8,21 @@ using System.Text;
|
|||||||
namespace StgSharp
|
namespace StgSharp
|
||||||
{
|
{
|
||||||
|
|
||||||
public delegate bool SensorRuleHandler(IGeometry target, IGeometry boarder);
|
public delegate bool SensorRuleHandler(IPlainGeometry target, IPlainGeometry boarder);
|
||||||
|
|
||||||
public class Sensor<T>
|
public class Sensor<T>
|
||||||
{
|
{
|
||||||
internal IGeometry _boarder;
|
internal IPlainGeometry _boarder;
|
||||||
internal IGeometry _target;
|
internal IPlainGeometry _target;
|
||||||
internal SensorRuleHandler _rule;
|
internal SensorRuleHandler _rule;
|
||||||
|
|
||||||
|
|
||||||
public IGeometry boarder
|
public IPlainGeometry boarder
|
||||||
{
|
{
|
||||||
get { return _boarder; }
|
get { return _boarder; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGeometry target
|
public IPlainGeometry target
|
||||||
{
|
{
|
||||||
get { return _target; }
|
get { return _target; }
|
||||||
set { _target = value; }
|
set { _target = value; }
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
314715e00ade86f2a7cd4e4d57040d6f16689d86
|
ce46d1bdaa8770ceaaf7ed3e62af2643adc523f6
|
||||||
|
|||||||
Reference in New Issue
Block a user