daily update on 20230120 by nitload youmu, struct of project fixed, math lib created

This commit is contained in:
Nitload
2023-01-20 00:45:19 +08:00
parent e9116ca11b
commit c14b7ae7f8
50 changed files with 202 additions and 159 deletions
+20 -6
View File
@@ -1,14 +1,13 @@
using StgSharp.Logic;
using StgSharp.Geometries;
using StgSharp;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
namespace StgSharp
{
public class Circle : IGeometrySimple
public class Circle : IGeometry
{
private Logic.ContainerNode<INode> _id;
private StgSharp.ContainerNode<INode> _id;
internal Point _referencePoint;
internal float _vecX;
internal float _vecY;
@@ -28,7 +27,10 @@ namespace StgSharp.Geometries
get { return _vecY; }
}
ContainerNode<INode> INode.ID
{
get { return _id; }
}
public float SetArrayX(Counter<uint> tickCounter)
{
@@ -39,5 +41,17 @@ namespace StgSharp.Geometries
{
throw new NotImplementedException();
}
void INode.setID<T>(ContainerNode<T> id)
{
if (_id == default(ContainerNode<INode>))
{
_id = id as ContainerNode<INode>;
}
else
{
throw new ArgumentException();
}
}
}
}
@@ -1,9 +1,9 @@
using StgSharp.Logic;
using StgSharp;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
namespace StgSharp
{
public delegate float GetLocationHandler(Counter<uint> tickCounter);
}
@@ -1,13 +1,13 @@
using StgSharp.Logic;
using StgSharp;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
namespace StgSharp
{
public interface IGeometrySimple:INode
public interface IGeometry:INode
{
public Point ReferencePoint
{
@@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
public interface IGeometryComplex
{
}
}
+19 -7
View File
@@ -1,14 +1,13 @@
using StgSharp.Control;
using StgSharp.Logic;
using StgSharp;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
namespace StgSharp
{
public class Line:IGeometrySimple
public class Line:IGeometry
{
private Logic.ContainerNode<INode> _id;
private ContainerNode<INode> _id;
internal Point _referencePoint;
internal float _vecX;
@@ -29,6 +28,10 @@ namespace StgSharp.Geometries
get { return _vecY; }
}
ContainerNode<INode> INode.ID
{
get { return _id; }
}
public Line( Point referencePoint, float vecX, float vecY)
{
@@ -45,8 +48,17 @@ namespace StgSharp.Geometries
{
return 0.0f;
}
void INode.setID<T>(ContainerNode<T> id)
{
if (id == null)
{
_id = id as ContainerNode<INode>;
}
else
{
throw new ArgumentNullException("Cannot set id teice!");
}
}
}
}
@@ -1,35 +0,0 @@
using StgSharp.Logic;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
public class Rectangle:IGeometryComplex
{
internal Point _vertex;
internal float _vecX1;
internal float _vecX2;
internal float _vecY1;
internal float _vecY2;
public Rectangle( Line side1, Line side2 )
{
_vecX1 = side1.VecX;
_vecX2 = side2.VecX;
_vecY1 = side1.VecY;
_vecY2 = side2.VecY;
if (_vecX1 * _vecX2 + _vecY1 * _vecY2 !=0 )
{
throw new ArgumentException("Given lines cannot form a rectangle!");
}
}
}
}
@@ -1,49 +0,0 @@
using StgSharp.Logic;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
public class Square:IGeometrySimple
{
private readonly Logic.ContainerNode<INode> _id;
internal Point _referrencePoint;
public float _vecX;
public float _vecY;
public Point ReferencePoint
{
get { return _referrencePoint; }
}
public float VecX
{
get { return _vecX; }
}
public float VecY
{
get
{
return _vecY;
}
}
public float SetArrayX(Counter<uint> tickCounter)
{
return 0.0f;
}
public float SetArrayY(Counter<uint> tickCounter)
{
return 0.0f;
}
}
}
@@ -0,0 +1,59 @@
using StgSharp;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public class Triangle : IGeometry
{
internal ContainerNode<INode> _id;
internal Point _referencePoint;
internal GetLocationHandler _setArrayXHandler;
internal GetLocationHandler _setArrayYHandler;
public Point ReferencePoint
{
get { return _referencePoint; }
}
public float VecX
{
get { return _referencePoint.X; }
}
public float VecY
{
get { return _referencePoint.Y; }
}
ContainerNode<INode> INode.ID
{
get { return _id; }
}
public float SetArrayX(Counter<uint> tickCounter)
{
return _setArrayXHandler.Invoke(tickCounter);
}
public float SetArrayY(Counter<uint> tickCounter)
{
return _setArrayYHandler.Invoke(tickCounter);
}
void INode.setID<T>(ContainerNode<T> id)
{
if (id == null)
{
_id = id as ContainerNode<INode>;
}
else
{
throw new ArgumentNullException("Cannot set id teice!");
}
}
}
}
+21 -9
View File
@@ -1,6 +1,5 @@
using GLFWDotNet;
using StgSharp.Control;
using StgSharp.Logic;
using StgSharp;
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -8,11 +7,11 @@ using System.Security.Cryptography;
using System.Text;
namespace StgSharp.Geometries
namespace StgSharp
{
public class Point: INode
{
private Logic.ContainerNode<Point> _id;
internal StgSharp.ContainerNode<INode> _id;
internal float _x;
internal float _y;
@@ -20,23 +19,36 @@ namespace StgSharp.Geometries
public GetLocationHandler getXHandler;
public GetLocationHandler getYHandler;
ContainerNode<INode> INode.ID
{
get { return this._id; }
}
public float X
{
get
{
return getXHandler(TimeLine.tickCounter);
return getXHandler(Control.TimeLine.tickCounter);
}
}
public float Y
{
get
{
return getYHandler(TimeLine.tickCounter);
return getYHandler(Control.TimeLine.tickCounter);
}
}
void INode.setID<T>(ContainerNode<T> id)
{
if (id == null)
{
_id = id as ContainerNode<INode>;
}
else
{
throw new ArgumentNullException("Cannot set id teice!");
}
}
}
}