123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- using System;
- using System.ComponentModel;
- using System.Runtime.Serialization;
- namespace CommonLang.Geometry
- {
-
-
-
-
-
- public class CurveKey : IEquatable<CurveKey>, IComparable<CurveKey>
- {
- #region Private Fields
- private CurveContinuity _continuity;
- private readonly float _position;
- private float _tangentIn;
- private float _tangentOut;
- private float _value;
- #endregion
- #region Properties
-
-
-
-
- public CurveContinuity Continuity
- {
- get { return this._continuity; }
- set { this._continuity = value; }
- }
-
-
-
-
- public float Position
- {
- get { return this._position; }
- }
-
-
-
-
- public float TangentIn
- {
- get { return this._tangentIn; }
- set { this._tangentIn = value; }
- }
-
-
-
-
- public float TangentOut
- {
- get { return this._tangentOut; }
- set { this._tangentOut = value; }
- }
-
-
-
-
- public float Value
- {
- get { return this._value; }
- set { this._value = value; }
- }
- #endregion
- #region Constructors
-
-
-
- public CurveKey() : this(0, 0)
- {
-
- }
-
-
-
-
-
- public CurveKey(float position, float value)
- : this(position, value, 0, 0, CurveContinuity.Smooth)
- {
- }
-
-
-
-
-
-
-
- public CurveKey(float position, float value, float tangentIn, float tangentOut)
- : this(position, value, tangentIn, tangentOut, CurveContinuity.Smooth)
- {
- }
-
-
-
-
-
-
-
-
- public CurveKey(float position, float value, float tangentIn, float tangentOut, CurveContinuity continuity)
- {
- this._position = position;
- this._value = value;
- this._tangentIn = tangentIn;
- this._tangentOut = tangentOut;
- this._continuity = continuity;
- }
- #endregion
-
-
-
-
-
-
-
- public static bool operator !=(CurveKey value1, CurveKey value2)
- {
- return !(value1 == value2);
- }
-
-
-
-
-
-
- public static bool operator ==(CurveKey value1, CurveKey value2)
- {
- if (object.Equals(value1, null))
- return object.Equals(value2, null);
- if (object.Equals(value2, null))
- return object.Equals(value1, null);
- return (value1._position == value2._position)
- && (value1._value == value2._value)
- && (value1._tangentIn == value2._tangentIn)
- && (value1._tangentOut == value2._tangentOut)
- && (value1._continuity == value2._continuity);
- }
-
-
-
-
- public CurveKey Clone()
- {
- return new CurveKey(this._position, this._value, this._tangentIn, this._tangentOut, this._continuity);
- }
- #region Inherited Methods
- public int CompareTo(CurveKey other)
- {
- return this._position.CompareTo(other._position);
- }
- public bool Equals(CurveKey other)
- {
- return (this == other);
- }
- public override bool Equals(object obj)
- {
- return (obj as CurveKey) != null && Equals((CurveKey)obj);
- }
- public override int GetHashCode()
- {
- return this._position.GetHashCode() ^ this._value.GetHashCode() ^ this._tangentIn.GetHashCode() ^
- this._tangentOut.GetHashCode() ^ this._continuity.GetHashCode();
- }
- #endregion
- }
- }
|