コード例 #1
0
ファイル: EffectCircle.cs プロジェクト: twigglius/Aurora
        public EffectCircle(float origin_x, float origin_y, float radius = 1.0f)
        {
            origin      = new EffectPoint(origin_x, origin_y);
            this.radius = radius;

            SetDefaultBounds();
        }
コード例 #2
0
ファイル: EffectCircle.cs プロジェクト: twigglius/Aurora
        public EffectCircle(EffectPoint origin, float radius = 1.0f)
        {
            this.origin = origin;
            this.radius = radius;

            SetDefaultBounds();
        }
コード例 #3
0
ファイル: EffectPoint.cs プロジェクト: twigglius/Aurora
        public bool Equals(EffectPoint p)
        {
            if ((object)p == null)
            {
                return(false);
            }

            return((X == p.X) && (Y == p.Y));
        }
コード例 #4
0
ファイル: EffectCircle.cs プロジェクト: twigglius/Aurora
        public EffectPoint GetPoint(float t)
        {
            EffectPoint ret = new EffectPoint(radius * (float)Math.Cos(t) + origin.X, radius * (float)Math.Sin(t) + origin.Y);

            if (ret.X < this.x_low_bound || ret.X > this.x_high_bound)
            {
                ret.X = float.NaN;
            }
            if (ret.Y < this.y_low_bound || ret.Y > this.y_high_bound)
            {
                ret.Y = float.NaN;
            }

            return(ret);
        }
コード例 #5
0
ファイル: EffectPoint.cs プロジェクト: twigglius/Aurora
        public override bool Equals(System.Object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            EffectPoint p = obj as EffectPoint;

            if ((System.Object)p == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return((X == p.X) && (Y == p.Y));
        }
コード例 #6
0
ファイル: EffectLine.cs プロジェクト: XevianLight/Aurora
        public EffectLine(EffectPoint start, EffectPoint end, bool isBoundedByPoints = false)
        {
            if ((end.X - start.X) <= 0.1f && (end.X - start.X) >= -0.1f)
            {
                this.slope    = float.NaN;
                this.y_offset = start.X + start.Y;
            }
            else
            {
                this.slope    = (end.Y - start.Y) / (end.X - start.X);
                this.y_offset = (-this.slope * start.X) + start.Y;
            }

            if (isBoundedByPoints)
            {
                if (start.X < end.X)
                {
                    SetXBounds(start.X, end.X);
                }
                else
                {
                    SetXBounds(end.X, start.X);
                }

                if (start.Y < end.Y)
                {
                    SetYBounds(start.Y, end.Y);
                }
                else
                {
                    SetYBounds(end.Y, start.Y);
                }
            }
            else
            {
                SetDefaultBounds();
            }
        }
コード例 #7
0
ファイル: EffectLine.cs プロジェクト: XevianLight/Aurora
        public EffectPoint GetPoint(float x)
        {
            EffectPoint ret;

            if (float.IsNaN(slope))
            {
                ret = new EffectPoint(y_offset, x);
            }
            else
            {
                ret = new EffectPoint(x, slope * x + y_offset);
            }

            if (ret.X < this.x_low_bound || ret.X > this.x_high_bound)
            {
                ret.X = float.NaN;
            }
            if (ret.Y < this.y_low_bound || ret.Y > this.y_high_bound)
            {
                ret.Y = float.NaN;
            }

            return(ret);
        }
コード例 #8
0
ファイル: EffectPoint.cs プロジェクト: twigglius/Aurora
 public EffectPoint(EffectPoint otherPoint)
 {
     X = otherPoint.X;
     Y = otherPoint.Y;
 }