Files
speckle-sharp-sdk/src/Speckle.Objects/Geometry/Box.cs
T
Claire Kuang 8a148b892f refactor(objects): removes unused classes and constructors (#151)
* removes unused classes and gh schema constructors

* additional cleanup of backwards compatibility (v2)

* Update Arc.cs

* updates unit tests

* re-adds bbox to box

* updates tests

* pr fixes for backwards compatibility

* Uses a new objects test in Revit for serialization tests

* format

* updates revit model curve class to inherit from curve geometry, and adds deprecated v2 classes

* fixes transform unit tests

* fixes deprecated speckle type

* removes unnecessary new revit curve classes

---------

Co-authored-by: Adam Hathcock <adam@hathcock.uk>
Co-authored-by: Alan Rynne <alan@rynne.es>
2024-11-04 17:05:16 +00:00

58 lines
1.7 KiB
C#

using Speckle.Newtonsoft.Json;
using Speckle.Objects.Primitive;
using Speckle.Sdk.Common;
using Speckle.Sdk.Models;
namespace Speckle.Objects.Geometry;
/// <summary>
/// Represents a 3-dimensional box oriented on a plane.
/// </summary>
[SpeckleType("Objects.Geometry.Box")]
public class Box : Base, IHasVolume, IHasArea, IHasBoundingBox
{
[JsonIgnore, Obsolete("Use plane property instead", true)]
public Plane basePlane
{
get => plane;
set => plane = value;
}
/// <summary>
/// Gets or sets the plane that defines the orientation of the <see cref="Box"/>
/// </summary>
public required Plane plane { get; set; }
/// <summary>
/// Gets or sets the <see cref="Interval"/> that defines the min and max coordinate in the X direction
/// </summary>
public required Interval xSize { get; set; }
/// <summary>
/// Gets or sets the <see cref="Interval"/> that defines the min and max coordinate in the Y direction
/// </summary>
public required Interval ySize { get; set; }
/// <summary>
/// Gets or sets the <see cref="Interval"/> that defines the min and max coordinate in the Y direction
/// </summary>
public required Interval zSize { get; set; }
/// <summary>
/// The units this object's coordinates are in.
/// </summary>
/// <remarks>
/// This should be one of <see cref="Units"/>
/// </remarks>
public required string units { get; set; }
/// <inheritdoc/>
public double area => 2 * (xSize.Length * ySize.Length + xSize.Length * zSize.Length + ySize.Length * zSize.Length);
[JsonIgnore, Obsolete("Boxs should not have a bounding box", true)]
public Box? bbox { get; }
/// <inheritdoc/>
public double volume => xSize.Length * ySize.Length * zSize.Length;
}