using Chernobyl.Mathematics.Movement; namespace Chernobyl.Mathematics.Geometry { /// /// A class whose implementation is defined by another /// instance. This class allows for easier creation of /// types that need to use other /// implementations or for classes that need to dynamically alter their /// implementation at runtime. This is an implementation of the decorator /// pattern (http://en.wikipedia.org/wiki/Decorator_pattern). /// public abstract class ShapeDecorator : TransformDecorator, IShape { /// /// The largest width of the object in the object's X axis. This should /// be the world width and not the local width. /// public float Width { get { return DecoratedShape.Width; } } /// /// The largest height of the object in the object's Y axis. This should /// be the world height and not the local height /// public float Height { get { return DecoratedShape.Height; } } /// /// The largest depth of the object in the object's Z axis. If the depth /// is zero, the object is 2D. This should be the world depth and not /// the local depth. /// public float Depth { get { return DecoratedShape.Depth; } } /// /// True if this is convex, false if it is concave /// or has 0 (such as a point). A /// is convex if for every pair of points within /// the object, every point on the straight line segment that joins them /// is also within the object. A concave is the /// opposite of this. /// public bool IsConvex { get { return DecoratedShape.IsConvex; } } /// /// The amount of space taken up by an object on a flat plane in /// square metres (m^2). /// public float Area { get { return DecoratedShape.Area; } } /// /// The amount of 3D space this object consumes in cubic metres (m^3). /// If this object is 2D, then the value of this property is zero. /// public float Volume { get { return DecoratedShape.Volume; } } /// /// The length of the path that surrounds a shape specified in metres (m). /// In the case of a closed curve such as a circle, this value represents /// the circumference of the object. /// public float Perimeter { get { return DecoratedShape.Perimeter; } } /// /// The minimum number of coordinates needed to specify each point /// within this object. For example: a point has 0 dimensions, a /// line has 1 dimension, a circle or rectangle has 2 dimensions, a /// cube or sphere has 3 dimensions, and a moving cube or sphere has 4. /// public uint Dimensions { get { return DecoratedShape.Dimensions; } } /// /// The instance that implements the /// functionality. /// protected abstract IShape DecoratedShape { get; } } }