Show / Hide Table of Contents

Class SimpleShape

A simply connected 2d shape. It consists of a Border outline and 0 or more holes. The holes don't overlap (disjunct) and reside totally inside the outline.

Inheritance
System.Object
SimpleShape
Implements
System.Runtime.Serialization.ISerializable
IQuadTreeInsertable
System.IComparable<SimpleShape>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: CADability.Shapes
Assembly: CADability.dll
Syntax
[Serializable]
public class SimpleShape : ISerializable, IQuadTreeInsertable, IComparable<SimpleShape>

Constructors

| Improve this Doc View Source

SimpleShape(Border)

Constructs a simple shape by specifying the outline

Declaration
public SimpleShape(Border outline)
Parameters
Type Name Description
Border outline

The outline

| Improve this Doc View Source

SimpleShape(Border, Border[])

Constructs a simple shape by specifying the outline and any number of holes.

Declaration
public SimpleShape(Border outline, params Border[] holes)
Parameters
Type Name Description
Border outline

The outline

Border[] holes

The holes

| Improve this Doc View Source

SimpleShape(SerializationInfo, StreamingContext)

Constructor required by deserialization

Declaration
protected SimpleShape(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
System.Runtime.Serialization.SerializationInfo info

SerializationInfo

System.Runtime.Serialization.StreamingContext context

StreamingContext

Properties

| Improve this Doc View Source

Area

Returns the area of this simple shape.

Declaration
public double Area { get; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

Empty

Returns true, if the Area of this shape is 0.0

Declaration
public bool Empty { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Holes

Returns all holes of this simple shape in an array. You may modify the array since it is a clone of the holes array in this object. But you may not modify the individual holes.

Declaration
public Border[] Holes { get; }
Property Value
Type Description
Border[]
| Improve this Doc View Source

NumHoles

Gets the number of holes in this simple shape.

Declaration
public int NumHoles { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Outline

Gets the outline of this simple shape. Do not modify the border because this shape might become invalid. To obtain a good performance the outline of this simple shape is returned, not a clone.

Declaration
public Border Outline { get; }
Property Value
Type Description
Border

Methods

| Improve this Doc View Source

CalculateSignature()

Declaration
public CompoundShape.Signature CalculateSignature()
Returns
Type Description
CompoundShape.Signature
| Improve this Doc View Source

Clip(ICurve2D, Boolean)

Clips the provided curve by this shape. Either the inner parts or the parts outside of this shape are returned.

Declaration
public double[] Clip(ICurve2D toClip, bool returnInsideParts)
Parameters
Type Name Description
ICurve2D toClip

Curve to be clipped

System.Boolean returnInsideParts

true: return inside parts, false: return outside parts

Returns
Type Description
System.Double[]

the clipped curves

| Improve this Doc View Source

Clone()

Returns a clone (deep copy) of this simple shape

Declaration
public SimpleShape Clone()
Returns
Type Description
SimpleShape

The clone

| Improve this Doc View Source

Contains(GeoPoint2D, Boolean)

Tests whether the provided point is contained in this simple shape.

Declaration
public bool Contains(GeoPoint2D p, bool acceptOnCurve)
Parameters
Type Name Description
GeoPoint2D p

The point to be examined

System.Boolean acceptOnCurve

true: accept points on the border as inside points, false: return true only for points totally inside this shape

Returns
Type Description
System.Boolean

true if the point is contained, false otherwise

| Improve this Doc View Source

Expand(Double)

Expands this simple shape by the given amount. note that the result is a CompoundShape which is composed of multiple simple shapes.

Declaration
public CompoundShape Expand(double d)
Parameters
Type Name Description
System.Double d

Amount to expand, if negative Shrink(Double) will be called

Returns
Type Description
CompoundShape

The resulting shape

| Improve this Doc View Source

GetExtent()

Returns the extent of this shape, i.e. the size of the horizontally adjusted rectangle that encloses it.

Declaration
public BoundingRect GetExtent()
Returns
Type Description
BoundingRect
| Improve this Doc View Source

GetModified(ModOp2D)

Returns a modified shape of this shape. This shape remains unchanged.

Declaration
public SimpleShape GetModified(ModOp2D m)
Parameters
Type Name Description
ModOp2D m

Modification by which this shape is modified

Returns
Type Description
SimpleShape
| Improve this Doc View Source

GetObjectData(SerializationInfo, StreamingContext)

Implements System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)

Declaration
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
System.Runtime.Serialization.SerializationInfo info

The System.Runtime.Serialization.SerializationInfo to populate with data.

System.Runtime.Serialization.StreamingContext context

The destination (System.Runtime.Serialization.StreamingContext) for this serialization.

| Improve this Doc View Source

GetPosition(CompoundShape, CompoundShape)

Checks the relative position of two shapes to each other. The order of the parameters is important for the result.

Declaration
public static SimpleShape.Position GetPosition(CompoundShape cs1, CompoundShape cs2)
Parameters
Type Name Description
CompoundShape cs1

First shape

CompoundShape cs2

Second shape

Returns
Type Description
SimpleShape.Position

The position

| Improve this Doc View Source

GetPosition(SimpleShape, SimpleShape)

Checks the relative position of two shapes to each other. The order of the parameters is important for the result.

Declaration
public static SimpleShape.Position GetPosition(SimpleShape s1, SimpleShape s2)
Parameters
Type Name Description
SimpleShape s1

First shape

SimpleShape s2

Second shape

Returns
Type Description
SimpleShape.Position

The position

| Improve this Doc View Source

GetSingleOutline()

Declaration
public Path2D GetSingleOutline()
Returns
Type Description
Path2D
| Improve this Doc View Source

HitTest(ref BoundingRect)

Checks whether this shape and the provided rectangle overlap

Declaration
public bool HitTest(ref BoundingRect Rect)
Parameters
Type Name Description
BoundingRect Rect
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Hole(Int32)

Gets the hole with the specified index. The original border is returned. Do not modify this or the simple shape might become invalid. If you need to modify it, make a clone first.

Declaration
public Border Hole(int Index)
Parameters
Type Name Description
System.Int32 Index
Returns
Type Description
Border
| Improve this Doc View Source

Intersect(SimpleShape, SimpleShape)

Returns the intersection (common parts, overlapping area) of two simple shapes.

Declaration
public static CompoundShape Intersect(SimpleShape Part1, SimpleShape Part2)
Parameters
Type Name Description
SimpleShape Part1

First shape

SimpleShape Part2

Second shape

Returns
Type Description
CompoundShape

The resulting shape (may be empty)

| Improve this Doc View Source

Intersect(SimpleShape, SimpleShape, Double)

Declaration
public static CompoundShape Intersect(SimpleShape Part1, SimpleShape Part2, double precision)
Parameters
Type Name Description
SimpleShape Part1
SimpleShape Part2
System.Double precision
Returns
Type Description
CompoundShape
| Improve this Doc View Source

isCongruent(SimpleShape, CompoundShape.Signature, out ModOp2D, Double)

Declaration
public bool isCongruent(SimpleShape other, CompoundShape.Signature otherSig, out ModOp2D thisToOther, double precision)
Parameters
Type Name Description
SimpleShape other
CompoundShape.Signature otherSig
ModOp2D thisToOther
System.Double precision
Returns
Type Description
System.Boolean
| Improve this Doc View Source

MakeLongHole(ICurve2D, Double, Double)

Declaration
public static SimpleShape MakeLongHole(ICurve2D centerLine, double halfWidth, double precision)
Parameters
Type Name Description
ICurve2D centerLine
System.Double halfWidth
System.Double precision
Returns
Type Description
SimpleShape
| Improve this Doc View Source

MakePaths(Plane)

Converts the outline and the holes of this shape into Path objects.

Declaration
public Path[] MakePaths(Plane plane)
Parameters
Type Name Description
Plane plane

Plane in 3D space where the shape is located

Returns
Type Description
Path[]

The resulting path(s)

| Improve this Doc View Source

Project(Plane, Plane)

The 2d-simple shape is assumed to reside in plane "fromPlane". It will be projected perpendicular onto the plane "toPlane". If the planes are perpendicular, the result will be am empty shape.

Declaration
public SimpleShape Project(Plane fromPlane, Plane toPlane)
Parameters
Type Name Description
Plane fromPlane

the containing plane

Plane toPlane

the projection plane

Returns
Type Description
SimpleShape

the projected shape

| Improve this Doc View Source

Reduce(Double)

Declaration
public void Reduce(double precision)
Parameters
Type Name Description
System.Double precision
| Improve this Doc View Source

Shrink(Double)

Shrinks this simple shape by the given amount. note that the result is a CompoundShape which is composed of multiple simple shapes.

Declaration
public CompoundShape Shrink(double d)
Parameters
Type Name Description
System.Double d

Amount to shrink, if negative Expand(Double) will be called

Returns
Type Description
CompoundShape

The resulting shape (may be empty)

| Improve this Doc View Source

Split(Border)

Returns a CompoundShape consisting of several SimpleShapes that touch each other. This SimpleShape is cut along the open Border ToSplitWith into several subshapes.

Declaration
public CompoundShape Split(Border ToSplitWith)
Parameters
Type Name Description
Border ToSplitWith

The curve to cut with (open Border)

Returns
Type Description
CompoundShape

Splitted shape

| Improve this Doc View Source

Subtract(SimpleShape, SimpleShape)

Returns the subtraction of Part1 minus Part2, i.e. all parts that belont to Part1 but not to Part2.

Declaration
public static CompoundShape Subtract(SimpleShape Part1, SimpleShape Part2)
Parameters
Type Name Description
SimpleShape Part1

Shape to be subtracted from

SimpleShape Part2

Shape that is subtracted

Returns
Type Description
CompoundShape

The resulting shape (may be empty)

| Improve this Doc View Source

ThickPolyLine(Polyline2D, Double)

Declaration
public static SimpleShape ThickPolyLine(Polyline2D p2d, double radius)
Parameters
Type Name Description
Polyline2D p2d
System.Double radius
Returns
Type Description
SimpleShape
| Improve this Doc View Source

Unite(SimpleShape, SimpleShape)

Returns the union of two simple shapes.

Declaration
public static CompoundShape Unite(SimpleShape Part1, SimpleShape Part2)
Parameters
Type Name Description
SimpleShape Part1

First shape

SimpleShape Part2

Second shape

Returns
Type Description
CompoundShape

The resulting shape (may be empty)

Explicit Interface Implementations

| Improve this Doc View Source

IQuadTreeInsertable.GetExtent()

Declaration
BoundingRect IQuadTreeInsertable.GetExtent()
Returns
Type Description
BoundingRect
| Improve this Doc View Source

IQuadTreeInsertable.HitTest(ref BoundingRect, Boolean)

Declaration
bool IQuadTreeInsertable.HitTest(ref BoundingRect rect, bool includeControlPoints)
Parameters
Type Name Description
BoundingRect rect
System.Boolean includeControlPoints
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IQuadTreeInsertable.ReferencedObject

Declaration
object IQuadTreeInsertable.ReferencedObject { get; }
Returns
Type Description
System.Object
| Improve this Doc View Source

IComparable<SimpleShape>.CompareTo(SimpleShape)

Declaration
int IComparable<SimpleShape>.CompareTo(SimpleShape other)
Parameters
Type Name Description
SimpleShape other
Returns
Type Description
System.Int32

Implements

System.Runtime.Serialization.ISerializable
IQuadTreeInsertable
System.IComparable<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX