diff --git a/源代码/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 b/源代码/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 index 48165c17..f1cc7805 100644 Binary files a/源代码/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 and b/源代码/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/1924fc48-6e19-4987-98f1-ff7d5ba21cad.vsidx b/源代码/.vs/StgSharp/FileContentIndex/1924fc48-6e19-4987-98f1-ff7d5ba21cad.vsidx deleted file mode 100644 index d52d7003..00000000 Binary files a/源代码/.vs/StgSharp/FileContentIndex/1924fc48-6e19-4987-98f1-ff7d5ba21cad.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/281267bd-19ef-4eed-ab2d-f26258ceb8da.vsidx b/源代码/.vs/StgSharp/FileContentIndex/281267bd-19ef-4eed-ab2d-f26258ceb8da.vsidx new file mode 100644 index 00000000..df2c604b Binary files /dev/null and b/源代码/.vs/StgSharp/FileContentIndex/281267bd-19ef-4eed-ab2d-f26258ceb8da.vsidx differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/684501f0-1be6-4634-8d00-9404128b739b.vsidx b/源代码/.vs/StgSharp/FileContentIndex/684501f0-1be6-4634-8d00-9404128b739b.vsidx deleted file mode 100644 index faf23ffe..00000000 Binary files a/源代码/.vs/StgSharp/FileContentIndex/684501f0-1be6-4634-8d00-9404128b739b.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/6ace0ea7-07ff-41aa-834a-e227741b1f3a.vsidx b/源代码/.vs/StgSharp/FileContentIndex/6ace0ea7-07ff-41aa-834a-e227741b1f3a.vsidx deleted file mode 100644 index 54921919..00000000 Binary files a/源代码/.vs/StgSharp/FileContentIndex/6ace0ea7-07ff-41aa-834a-e227741b1f3a.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/6f7f2525-09d1-44bc-9a2c-2779a1b737ef.vsidx b/源代码/.vs/StgSharp/FileContentIndex/6f7f2525-09d1-44bc-9a2c-2779a1b737ef.vsidx deleted file mode 100644 index e9b7bd30..00000000 Binary files a/源代码/.vs/StgSharp/FileContentIndex/6f7f2525-09d1-44bc-9a2c-2779a1b737ef.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/772ea82e-2cca-4ccd-95ec-d379d105eb3c.vsidx b/源代码/.vs/StgSharp/FileContentIndex/772ea82e-2cca-4ccd-95ec-d379d105eb3c.vsidx new file mode 100644 index 00000000..9a1909a7 Binary files /dev/null and b/源代码/.vs/StgSharp/FileContentIndex/772ea82e-2cca-4ccd-95ec-d379d105eb3c.vsidx differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/cc2d6458-9702-4d41-b948-e52b7bb39066.vsidx b/源代码/.vs/StgSharp/FileContentIndex/cc2d6458-9702-4d41-b948-e52b7bb39066.vsidx new file mode 100644 index 00000000..b6bfda94 Binary files /dev/null and b/源代码/.vs/StgSharp/FileContentIndex/cc2d6458-9702-4d41-b948-e52b7bb39066.vsidx differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/e1b78524-447f-4554-953e-4302fcbd569a.vsidx b/源代码/.vs/StgSharp/FileContentIndex/e1b78524-447f-4554-953e-4302fcbd569a.vsidx new file mode 100644 index 00000000..5fc40860 Binary files /dev/null and b/源代码/.vs/StgSharp/FileContentIndex/e1b78524-447f-4554-953e-4302fcbd569a.vsidx differ diff --git a/源代码/.vs/StgSharp/v17/.suo b/源代码/.vs/StgSharp/v17/.suo index a09472cf..28401779 100644 Binary files a/源代码/.vs/StgSharp/v17/.suo and b/源代码/.vs/StgSharp/v17/.suo differ diff --git a/源代码/StgSharp/Control/Add.cs b/源代码/StgSharp/Control/Add.cs index 96b72d75..a9fa1c21 100644 --- a/源代码/StgSharp/Control/Add.cs +++ b/源代码/StgSharp/Control/Add.cs @@ -12,17 +12,18 @@ namespace StgSharp.Control 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); } } - public static void Geometry(IGeometry geometry) + public static void Geometry(IPlainGeometry geometry) { GameTimeLine._currentPool.geometryContainer.Add(geometry); + GameTimeLine._currentPool.pointContainer.Add(geometry.RefPoint); } } } diff --git a/源代码/StgSharp/Entities/IEntity.cs b/源代码/StgSharp/Entities/IEntity.cs index 221c64d8..b0276e1f 100644 --- a/源代码/StgSharp/Entities/IEntity.cs +++ b/源代码/StgSharp/Entities/IEntity.cs @@ -9,15 +9,15 @@ namespace StgSharp public abstract class IEntity:INode { internal Point _pos; - internal LinkedList _collisionBox; - internal Sensor _collisionSensor; + internal LinkedList _collisionBox; + internal Sensor _collisionSensor; internal string _texture; internal Point _position; internal Point _basePoint; internal GetLocationHandler _movHandler; protected uint _bornTick; - public LinkedList CollisionBox + public LinkedList CollisionBox { get { return _collisionBox; } set { _collisionBox = value; } @@ -26,7 +26,7 @@ namespace StgSharp /// /// A sensor used for cheking out if a bullet hit a player or something else /// - public Sensor CollisionSensor + public Sensor CollisionSensor { get { return _collisionSensor; } set { _collisionSensor = value; } diff --git a/源代码/StgSharp/Geometries/Arc.cs b/源代码/StgSharp/Geometries/Arc.cs index a3d18d9c..00856241 100644 --- a/源代码/StgSharp/Geometries/Arc.cs +++ b/源代码/StgSharp/Geometries/Arc.cs @@ -7,7 +7,7 @@ using System.Text; namespace StgSharp.Geometries { - public class Arc : IGeometry + public class Arc : IPlainGeometry { internal Point _basePoint; internal Point _center; diff --git a/源代码/StgSharp/Geometries/Circle.cs b/源代码/StgSharp/Geometries/Circle.cs index 82afcce0..4f6334aa 100644 --- a/源代码/StgSharp/Geometries/Circle.cs +++ b/源代码/StgSharp/Geometries/Circle.cs @@ -1,15 +1,17 @@ -using StgSharp.Math; +using StgSharp.Linear; +using StgSharp.Math; using System; using System.Collections.Generic; using System.Text; namespace StgSharp.Geometries { - public class Circle : IGeometry + public class Circle : IPlainGeometry { internal Point _baseCenter; internal Point _center; - internal Point _radiusVec; + internal Point _pointOnCircle; + internal Point _pointOnPlain; internal RenderMode _renderMode; internal readonly uint bornTick; @@ -17,9 +19,9 @@ namespace StgSharp.Geometries 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; @@ -40,19 +42,19 @@ namespace StgSharp.Geometries 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) { - throw new NotImplementedException(); + _pointOnPlain._position = vec + UpdatePlain(tick); } public virtual vec3d MoveCenter(uint tick) => default; public virtual vec3d UpdateRadius(uint tick) => default; - + public virtual vec3d UpdatePlain(uint tick) => default; public override float SetArrayX() { @@ -64,6 +66,11 @@ namespace StgSharp.Geometries throw new NotImplementedException(); } + public override Plain GetPlain() + { + return new Plain(_center,_pointOnCircle,_pointOnPlain); + } + internal override void OnRender(uint tick) { tick-=bornTick; diff --git a/源代码/StgSharp/Geometries/GeometryCalc.cs b/源代码/StgSharp/Geometries/GeometryCalc.cs deleted file mode 100644 index c7e5f31e..00000000 --- a/源代码/StgSharp/Geometries/GeometryCalc.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StgSharp.Geometries -{ - public static unsafe class GeometryCalc - { - } -} diff --git a/源代码/StgSharp/Geometries/IGeometry.cs b/源代码/StgSharp/Geometries/IPlainGeometry.cs similarity index 80% rename from 源代码/StgSharp/Geometries/IGeometry.cs rename to 源代码/StgSharp/Geometries/IPlainGeometry.cs index d239ec1b..2d7b3ed7 100644 --- a/源代码/StgSharp/Geometries/IGeometry.cs +++ b/源代码/StgSharp/Geometries/IPlainGeometry.cs @@ -1,11 +1,12 @@ -using StgSharp.Math; +using StgSharp.Linear; +using StgSharp.Math; using System; using System.Collections.Generic; using System.Text; namespace StgSharp.Geometries { - public abstract class IGeometry:INode + public abstract class IPlainGeometry:INode { private readonly uint bornTick; @@ -15,17 +16,17 @@ namespace StgSharp.Geometries public abstract Point RefVec02{ get; } public uint BornTime => bornTick; - public IGeometry(uint bornTime) + public IPlainGeometry(uint bornTime) { bornTick=bornTime; } - public IGeometry(Counter MainTimer) + public IPlainGeometry(Counter MainTimer) { bornTick = MainTimer.Value; } - public IGeometry() { } + public IPlainGeometry() { } internal abstract void CalcVec01(uint tick); internal abstract void CalcVec02(vec3d vec, uint tick); @@ -38,6 +39,8 @@ namespace StgSharp.Geometries public abstract Line[] GetAllSides(); + public abstract Plain GetPlain(); + } diff --git a/源代码/StgSharp/Geometries/IGeometryCombination.cs b/源代码/StgSharp/Geometries/IPlainGeometryCombination.cs similarity index 59% rename from 源代码/StgSharp/Geometries/IGeometryCombination.cs rename to 源代码/StgSharp/Geometries/IPlainGeometryCombination.cs index 0557f512..0232a965 100644 --- a/源代码/StgSharp/Geometries/IGeometryCombination.cs +++ b/源代码/StgSharp/Geometries/IPlainGeometryCombination.cs @@ -4,23 +4,23 @@ using System.Text; namespace StgSharp.Geometries { - public abstract class IGeometryCombination:LinkedList + public abstract class IPlainGeometryCombination:LinkedList { internal readonly uint _bornTick; internal abstract void toSimpleGeometry(); - public IGeometryCombination(uint bornTime) + public IPlainGeometryCombination(uint bornTime) { _bornTick = bornTime; } - public IGeometryCombination(Counter timer) + public IPlainGeometryCombination(Counter timer) { _bornTick = timer._value; } - public IGeometryCombination() + public IPlainGeometryCombination() { } diff --git a/源代码/StgSharp/Geometries/Line.cs b/源代码/StgSharp/Geometries/Line.cs index 3160e7e4..ebc4e91d 100644 --- a/源代码/StgSharp/Geometries/Line.cs +++ b/源代码/StgSharp/Geometries/Line.cs @@ -8,7 +8,7 @@ using System.Text; namespace StgSharp.Geometries { - public class Line:IGeometry + public class Line:IPlainGeometry { internal Point _basePoint = default ; internal Point _beginPoint = default ; diff --git a/源代码/StgSharp/Geometries/Parallelogram.cs b/源代码/StgSharp/Geometries/Parallelogram.cs index 9b842e5c..dd83286e 100644 --- a/源代码/StgSharp/Geometries/Parallelogram.cs +++ b/源代码/StgSharp/Geometries/Parallelogram.cs @@ -6,21 +6,21 @@ using System.Text; namespace StgSharp.Geometries { - internal class Parallelogram : IGeometry + internal class Parallelogram : IPlainGeometry { internal Point _basePoint; internal Point _center; - internal Point _corner1; - internal Point _corner2; + internal Point _vertex1; + internal Point _vertex2; internal RenderMode _renderMode; internal readonly uint bornTick; public override sealed Point BasePoint => _basePoint; 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; @@ -72,13 +72,13 @@ namespace StgSharp.Geometries //计算第一个顶点的位移,存在相对中心位移和相对参考原点位移两种模式 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) { - _corner2._position = vec + UpdateCTC2(tick); + _vertex2._position = vec + UpdateCTC2(tick); } public virtual vec3d MovCenter(uint tick) => default(vec3d); @@ -87,10 +87,14 @@ namespace StgSharp.Geometries public virtual vec3d UpdateCTC2(uint tick) => default(vec3d); + /// + /// 获取平行四边形的全部边 + /// + /// public override Line[] GetAllSides() { - Line[] lines = new Line[4] + Line[] sides = new Line[4] { new Line(GameTimeLine.tickCounter), new Line(GameTimeLine.tickCounter), @@ -99,42 +103,36 @@ namespace StgSharp.Geometries }; - lines[0]._basePoint = this._corner1; - lines[0]._beginPoint = this._corner1; - lines[0]._endPoint = this._corner2; + sides[0]._basePoint = this._vertex1; + sides[0]._beginPoint = this._vertex1; + sides[0]._endPoint = this._vertex2; - lines[1]._basePoint = this._corner2; - lines[1]._beginPoint = this._corner2; - lines[1]._endPoint = new Point() { _position = getCorner3(GameTimeLine.tickCounter)}; - lines[1].movEnd += this.getCorner3; + sides[1]._basePoint = this._vertex2; + sides[1]._beginPoint = this._vertex2; + sides[1]._endPoint = new Point() { _position = GetVertex3(GameTimeLine.tickCounter)}; + sides[1].movEnd += this.GetVertex3; - lines[2]._basePoint = lines[1]._endPoint; - lines[2]._beginPoint = lines[2]._basePoint; - lines[2]._endPoint = new Point() { _position = this.getCorner4(GameTimeLine.tickCounter) }; - lines[2].movEnd+= this.getCorner4; + 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; - lines[3]._beginPoint = lines[2]._endPoint; - lines[3]._endPoint = this._corner1; + sides[3]._beginPoint = sides[2]._endPoint; + sides[3]._endPoint = this._vertex1; - return lines; + return sides; } - protected vec3d getCorner1(Counter tick) + + protected vec3d GetVertex3(Counter tick) { - return this._corner1._position; - } - protected vec3d getCorner2(Counter tick) - { - return this._corner2._position; - } - protected vec3d getCorner3(Counter tick) - { - return 2 * this._center._position - this._corner1._position; + return 2 * this._center._position - this._vertex1._position; } - protected vec3d getCorner4(Counter tick) + protected vec3d GetVertex4(Counter tick) { - return 2 * this._center._position - this._corner2._position; + return 2 * this._center._position - this._vertex2._position; } + } } diff --git a/源代码/StgSharp/Geometries/Point.cs b/源代码/StgSharp/Geometries/Point.cs index 1c44a44c..f7b76d77 100644 --- a/源代码/StgSharp/Geometries/Point.cs +++ b/源代码/StgSharp/Geometries/Point.cs @@ -26,11 +26,20 @@ namespace StgSharp.Geometries 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) + { + + } } } diff --git a/源代码/StgSharp/Geometries/Polygon.cs b/源代码/StgSharp/Geometries/Polygon.cs index 044b9dc9..f4c9b926 100644 --- a/源代码/StgSharp/Geometries/Polygon.cs +++ b/源代码/StgSharp/Geometries/Polygon.cs @@ -5,7 +5,7 @@ using System.Text; namespace StgSharp.Geometries { - public class Polygon : IGeometryCombination + public class Polygon : IPlainGeometryCombination { internal Point[] pointsArray; diff --git a/源代码/StgSharp/Geometries/Rectangle.cs b/源代码/StgSharp/Geometries/Rectangle.cs index 54767524..c28864e1 100644 --- a/源代码/StgSharp/Geometries/Rectangle.cs +++ b/源代码/StgSharp/Geometries/Rectangle.cs @@ -1,25 +1,27 @@ -using StgSharp.Math; +using StgSharp.Control; +using StgSharp.Linear; +using StgSharp.Math; using System; using System.Collections.Generic; using System.Text; namespace StgSharp.Geometries { - public class Rectangle : IGeometry + public class Rectangle : IPlainGeometry { internal Point _basePoint; internal Point _center; - internal Point _centerToCorner1; - internal Point _centerToCorner2; + internal Point _vertex1; + internal Point _vertex2; internal RenderMode _renderMode; internal readonly uint bornTick; public override sealed Point BasePoint => _basePoint; 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; @@ -75,7 +77,7 @@ namespace StgSharp.Geometries /// 当前游戏刻 internal override void CalcVec02(vec3d vec, uint tick) { - _centerToCorner1._position = vec + UpdateCTC1(tick); + _vertex1._position = vec + UpdateCTC1(tick); } /// @@ -87,9 +89,9 @@ namespace StgSharp.Geometries /// 计算出的第二条对角线长与第一条不相等 internal override void CalcVec03(vec3d vec, uint tick) { - _centerToCorner2._position = vec + UpdateCTC2(tick); - if (_centerToCorner1._position.GetLength() - == _centerToCorner2._position.GetLength()) + _vertex2._position = vec + UpdateCTC2(tick); + if (_vertex1._position.GetLength() + == _vertex2._position.GetLength()) { throw new ArgumentException("Cannot form a triangle, " + "two crossing lines are not equal!"); @@ -114,7 +116,49 @@ namespace StgSharp.Geometries 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 tick) + { + return 2 * this._center._position - this._vertex1._position; + } + + protected vec3d GetVertex4(Counter tick) + { + return 2 * this._center._position - this._vertex2._position; } } } diff --git a/源代码/StgSharp/Geometries/ToUpperDimensionException.cs b/源代码/StgSharp/Geometries/ToUpperDimensionException.cs new file mode 100644 index 00000000..aaaabb03 --- /dev/null +++ b/源代码/StgSharp/Geometries/ToUpperDimensionException.cs @@ -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) + { + } + } +} diff --git a/源代码/StgSharp/Geometries/Triangle.cs b/源代码/StgSharp/Geometries/Triangle.cs index 3551fd0c..377fad44 100644 --- a/源代码/StgSharp/Geometries/Triangle.cs +++ b/源代码/StgSharp/Geometries/Triangle.cs @@ -7,22 +7,22 @@ using System.Text; namespace StgSharp.Geometries { - public class Triangle :IGeometry + public class Triangle :IPlainGeometry { internal Point _basePoint; - internal Point _beginPoint; - internal Point _line1; - internal Point _line2; + internal Point _vertex1; + internal Point _vertex2; + internal Point _vertex3; internal RenderMode _renderMode; internal readonly uint bornTick; 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; @@ -38,17 +38,17 @@ namespace StgSharp.Geometries 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) { - _line1._position = vec + CalcSide1(tick); + _vertex2._position = vec + CalcSide1(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); @@ -67,8 +67,8 @@ namespace StgSharp.Geometries CalcVec03(BasePoint._position,tick); break; case RenderMode.RefPoint: - CalcVec02(_beginPoint._position,tick); - CalcVec03(_beginPoint._position,tick); + CalcVec02(_vertex1._position,tick); + CalcVec03(_vertex1._position,tick); break; default: break; @@ -84,5 +84,24 @@ namespace StgSharp.Geometries { 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; + } } } diff --git a/源代码/StgSharp/Linear/Cordination.cs b/源代码/StgSharp/Linear/Cordination.cs index 0178a991..f56588b7 100644 --- a/源代码/StgSharp/Linear/Cordination.cs +++ b/源代码/StgSharp/Linear/Cordination.cs @@ -4,6 +4,7 @@ using System.Text; namespace StgSharp.Math { + internal class Cordination { } diff --git a/源代码/StgSharp/Linear/Plain.cs b/源代码/StgSharp/Linear/Plain.cs new file mode 100644 index 00000000..35e25c06 --- /dev/null +++ b/源代码/StgSharp/Linear/Plain.cs @@ -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; + } + + } +} diff --git a/源代码/StgSharp/Logic/Pool.cs b/源代码/StgSharp/Logic/Pool.cs index 6201aac7..37e631a5 100644 --- a/源代码/StgSharp/Logic/Pool.cs +++ b/源代码/StgSharp/Logic/Pool.cs @@ -12,7 +12,7 @@ namespace StgSharp public class Pool:INode { internal LinkedList pointContainer; - internal LinkedList geometryContainer; + internal LinkedList geometryContainer; internal LinkedList _bulletContainer; internal LinkedList _awardContainer; internal LinkedList _enemyContainer; diff --git a/源代码/StgSharp/Logic/Sensor.cs b/源代码/StgSharp/Logic/Sensor.cs index 5b5d37c6..3d9cd683 100644 --- a/源代码/StgSharp/Logic/Sensor.cs +++ b/源代码/StgSharp/Logic/Sensor.cs @@ -8,21 +8,21 @@ using System.Text; namespace StgSharp { - public delegate bool SensorRuleHandler(IGeometry target, IGeometry boarder); + public delegate bool SensorRuleHandler(IPlainGeometry target, IPlainGeometry boarder); public class Sensor { - internal IGeometry _boarder; - internal IGeometry _target; + internal IPlainGeometry _boarder; + internal IPlainGeometry _target; internal SensorRuleHandler _rule; - public IGeometry boarder + public IPlainGeometry boarder { get { return _boarder; } } - public IGeometry target + public IPlainGeometry target { get { return _target; } set { _target = value; } diff --git a/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache b/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache index 8def265d..4096f5f2 100644 --- a/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache +++ b/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -314715e00ade86f2a7cd4e4d57040d6f16689d86 +ce46d1bdaa8770ceaaf7ed3e62af2643adc523f6