before candybox editor update
This commit is contained in:
42
Plugins/CandyboxPlugin/Recipe/CandyParameter.cs
Normal file
42
Plugins/CandyboxPlugin/Recipe/CandyParameter.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
namespace CandyboxPlugin.Recipe
|
||||
{
|
||||
public class CandyParameter
|
||||
{
|
||||
private Point? _originalPoint;
|
||||
public Queue<float[]> Histogram { get; set; } = new Queue<float[]>();
|
||||
|
||||
public Point Position { get; set; }
|
||||
public int OuterRadius { get; set; }
|
||||
public int InnerRadius { get; set; }
|
||||
public float Weight { get; set; } = 1;
|
||||
|
||||
|
||||
public void ResetPoint()
|
||||
{
|
||||
if (_originalPoint != null)
|
||||
{
|
||||
Position = _originalPoint.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public void RotatePoint(Point centerPoint, double angleInRadians)
|
||||
{
|
||||
_originalPoint = Position;
|
||||
double cosTheta = Math.Cos(angleInRadians);
|
||||
double sinTheta = Math.Sin(angleInRadians);
|
||||
Position = new Point
|
||||
{
|
||||
X =
|
||||
(int)
|
||||
(cosTheta * (Position.X - centerPoint.X) -
|
||||
sinTheta * (Position.Y - centerPoint.Y) + centerPoint.X),
|
||||
Y =
|
||||
(int)
|
||||
(sinTheta * (Position.X - centerPoint.X) +
|
||||
cosTheta * (Position.Y - centerPoint.Y) + centerPoint.Y)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user