Rhino C++ API  8.5
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
ON_OutlineFigure Class Reference

#include <opennurbs_font.h>

Public Types

enum  Orientation : ON__UINT8 {
  Orientation::Unset = 0, Orientation::CounterClockwise = 1, Orientation::Clockwise = 2, Orientation::NotOriented = 3,
  Orientation::Error = 15
}
 
enum  Type : ON__UINT8 {
  Type::Unset = 0, Type::Unknown = 1, Type::SingleStroke = 2, Type::DoubleStroke = 3,
  Type::Perimeter = 4, Type::NotPerimeter = 5, Type::Mixed = 7
}
 ON_OutlineFigure::Type identifies the structure of the figure. More...
 

Public Member Functions

 ON_OutlineFigure ()=default
 
 ON_OutlineFigure (const ON_OutlineFigure &)=default
 
 ~ON_OutlineFigure ()=default
 
double AreaEstimate () const
 
const ON_BoundingBox BoundingBox () const
 
double BoxArea () const
 
double DefaultPolylineTolerance () const
 
ON__UINT16 FigureIndex () const
 
ON_OutlineFigure::Orientation FigureOrientation () const
 
ON_OutlineFigure::Type FigureType () const
 
unsigned int GetFigureCurves (double scale, bool b3d, ON_SimpleArray< ON_Curve * > &figure_curves) const
 
unsigned int GetFigureCurves (double scale, bool b3d, ON_SimpleArray< ON_NurbsCurve * > &figure_curves) const
 
unsigned int GetPolyline (double tolerance, ON_SimpleArray< ON_2dPoint > &points) const
 
unsigned int GetPolyline (double tolerance, ON_SimpleArray< ON_2fPoint > &points) const
 
unsigned int GetPolyline (double tolerance, ON_SimpleArray< ON_3dPoint > &points) const
 
unsigned int GetPolyline (double tolerance, ON_SimpleArray< ON_3fPoint > &points) const
 
unsigned int GetPolyline (double tolerance, void(*PointCallbackFunc)(float x, float y, void *), void *context) const
 
unsigned GetUpToFourPointsOnFigure (ON_2fPoint p[4]) const
 
bool IsInsideOf (const ON_OutlineFigure *outer_figure, bool bPerformExtraChecking) const
 
bool IsValidFigure (bool bLogErrors) const
 
bool NegateY ()
 
ON_OutlineFigureoperator= (const ON_OutlineFigure &)=default
 
bool ReverseFigure ()
 
ON__UINT32 UnitsPerEM () const
 
int WindingNumber (ON_2fPoint winding_point) const
 

Static Public Member Functions

static double DefaultPolylineTolerance (double units_per_em)
 
static ON_OutlineFigure::Type FigureTypeFromField10Description (const ON_wString field_10_description)
 
static ON_OutlineFigure::Type FigureTypeFromFontName (const wchar_t *font_name)
 
static const wchar_t * OrientationToWideString (ON_OutlineFigure::Orientation orientation)
 

Public Attributes

ON__UINT16 m_figure_index = 0
 
ON_SimpleArray< ON_OutlineFigurePointm_points
 

Static Public Attributes

static const ON_OutlineFigure Unset
 

Friends

class ON_Outline
 

Member Enumeration Documentation

◆ Orientation

Enumerator
Unset 
CounterClockwise 
Clockwise 
NotOriented 
Error 

An error occurred in orientation calculations.

◆ Type

ON_OutlineFigure::Type identifies the structure of the figure.

Enumerator
Unset 

summary> This value should be used for parameters where the type is has not been explicitly to determined. /summary> summary> Unknown indicates an attempt was made to determine the type, that attempt failed, and further attempts will just waste time. It is best to pass Unset when calling functions and you have not calculated the type. /summary>

Unknown 

summary> Single stroke figures can be open or closed and are not designed to be filled. Single stroke fonts like RhSS and MecSoft have these types of figures. /summary>

SingleStroke 

summary> Double stroke figures are closed and contain no area. They consist of a single stroke path follow by the reverse of the single stroke path. The CamBam Stick fonts have these types of figures. A double stroke figure can be converted to a single stroke figure by removing the reversed overlapping portion. /summary>

DoubleStroke 

summary> The outline figures are perimeters around non-empty areas that are typically filled or hollow depending on their orientation. The majority of TrueType, OpenType, and PostScript fonts have these types of figures. /summary>

Perimeter 

summary> The outline figure is not a perimeter around a non-empty area. /summary>

NotPerimeter 

summary> Used in a context where there are multiple figures with different types. /summary>

Mixed 

Constructor & Destructor Documentation

◆ ON_OutlineFigure() [1/2]

ON_OutlineFigure::ON_OutlineFigure ( )
default

◆ ~ON_OutlineFigure()

ON_OutlineFigure::~ON_OutlineFigure ( )
default

◆ ON_OutlineFigure() [2/2]

ON_OutlineFigure::ON_OutlineFigure ( const ON_OutlineFigure )
default

Member Function Documentation

◆ AreaEstimate()

double ON_OutlineFigure::AreaEstimate ( ) const

Returns: Signed area estimate. For simple closed curves, a positive area indicates a counter-clockwise orientation.

◆ BoundingBox()

const ON_BoundingBox ON_OutlineFigure::BoundingBox ( ) const

◆ BoxArea()

double ON_OutlineFigure::BoxArea ( ) const

Returns: Bounding box area >= 0

◆ DefaultPolylineTolerance() [1/2]

double ON_OutlineFigure::DefaultPolylineTolerance ( ) const

◆ DefaultPolylineTolerance() [2/2]

static double ON_OutlineFigure::DefaultPolylineTolerance ( double  units_per_em)
static

◆ FigureIndex()

ON__UINT16 ON_OutlineFigure::FigureIndex ( ) const

◆ FigureOrientation()

ON_OutlineFigure::Orientation ON_OutlineFigure::FigureOrientation ( ) const

Returns: Figure orientation.

◆ FigureType()

ON_OutlineFigure::Type ON_OutlineFigure::FigureType ( ) const

Returns: Figure type.

◆ FigureTypeFromField10Description()

static ON_OutlineFigure::Type ON_OutlineFigure::FigureTypeFromField10Description ( const ON_wString  field_10_description)
static

Description: Opennurbs searches the description saved in field 10 of the name table for the strings "Engraving - single stroke" / "Engraving - double stroke" / "Engraving" to identify fonts that are desgned for engraving (and which tend to render poorly when used to display text devices like screens, monitors, and printers). The SLF (single line fonts) are examples of fonts that have Engraving in field 10. Parameters: field_10_description - [in] Field 10 string from the font name table. Returns: If the description contains "single stroke", returns ON_OutlineFigure::Type::SingleStroke. If the description contains "double stroke", returns ON_OutlineFigure::Type::DoubleStroke. Otherwise returns ON_OutlineFigure::Type::Unset;

◆ FigureTypeFromFontName()

static ON_OutlineFigure::Type ON_OutlineFigure::FigureTypeFromFontName ( const wchar_t *  font_name)
static

Returns: If the figure type is known for certain, that type is returned. Otherwise ON_OutlineFigure::Type::Unknown is returned.

◆ GetFigureCurves() [1/2]

unsigned int ON_OutlineFigure::GetFigureCurves ( double  scale,
bool  b3d,
ON_SimpleArray< ON_Curve * > &  figure_curves 
) const

◆ GetFigureCurves() [2/2]

unsigned int ON_OutlineFigure::GetFigureCurves ( double  scale,
bool  b3d,
ON_SimpleArray< ON_NurbsCurve * > &  figure_curves 
) const

◆ GetPolyline() [1/5]

unsigned int ON_OutlineFigure::GetPolyline ( double  tolerance,
ON_SimpleArray< ON_2dPoint > &  points 
) const

Description: Get a polyline approximation of the figure. Parameters: tolerance - [in] If tolerance > 0, that value is used. Otherwise UnitsPerEM() / 256.0 is used, which gives course but recognizable decent results for glyph outlines. points - [out] polyline points are appended to this array. Returns: Number of points appended to oiunts[]

◆ GetPolyline() [2/5]

unsigned int ON_OutlineFigure::GetPolyline ( double  tolerance,
ON_SimpleArray< ON_2fPoint > &  points 
) const

Description: Get a polyline approximation of the figure. Parameters: tolerance - [in] If tolerance > 0, that value is used. Otherwise UnitsPerEM() / 256.0 is used, which gives course but recognizable decent results for glyph outlines. points - [out] polyline points are appended to this array. Returns: Number of points appended to oiunts[]

◆ GetPolyline() [3/5]

unsigned int ON_OutlineFigure::GetPolyline ( double  tolerance,
ON_SimpleArray< ON_3dPoint > &  points 
) const

Description: Get a polyline approximation of the figure. Parameters: tolerance - [in] If tolerance > 0, that value is used. Otherwise UnitsPerEM() / 256.0 is used, which gives course but recognizable decent results for glyph outlines. points - [out] polyline points are appended to this array. Returns: Number of points appended to oiunts[]

◆ GetPolyline() [4/5]

unsigned int ON_OutlineFigure::GetPolyline ( double  tolerance,
ON_SimpleArray< ON_3fPoint > &  points 
) const

Description: Get a polyline approximation of the figure. Parameters: tolerance - [in] If tolerance > 0, that value is used. Otherwise UnitsPerEM() / 256.0 is used, which gives course but recognizable decent results for glyph outlines. points - [out] polyline points are appended to this array. Returns: Number of points appended to oiunts[]

◆ GetPolyline() [5/5]

unsigned int ON_OutlineFigure::GetPolyline ( double  tolerance,
void(*)(float x, float y, void *)  PointCallbackFunc,
void *  context 
) const

Description: Get a polyline approximation of the figure.

Parameters: tolerance - [in] If tolerance > 0, that value is used. Otherwise UnitsPerEM() / 256.0 is used, which gives course but recognizable decent results for glyph outlines.

PointCallbackFunc - [in] called once for each point in the polyline context - [in] third parameter to PointCallbackFunc() Returns: Number of points passed to PointCallbackFunc()

◆ GetUpToFourPointsOnFigure()

unsigned ON_OutlineFigure::GetUpToFourPointsOnFigure ( ON_2fPoint  p[4]) const

Description: Get up to four distinct points on the figure. These are useful for winding number tests when sorting figures. Parameters: p - [out] the returned points will be on the figure (not bezier interior control points). Returns: Number of points.

◆ IsInsideOf()

bool ON_OutlineFigure::IsInsideOf ( const ON_OutlineFigure outer_figure,
bool  bPerformExtraChecking 
) const

Description: Determines if this ON_OutlineFigure is inside of outer_figure. Parameters: outer_figure - [in] When bPerformExtraChecking is false, outer_figure->FigureOrientation() should be set to what you plan on using when rendering the glyph. The orientation of outer_figur can be either clockwise or counterclockwise and, in the context of the entire glyph, outer_figure can be an inner or outer boundary. For example, the registered trademark glyph (UNICODE U+00AE) is an example where four nested figures with alternating orientations are common. bPerformExtraChecking - [in] In general, when sorting glyph outlines as they come froma font file, set outer_figure->FigureOrientation() to what will be used to render the glyph and pass false for bPerformExtraChecking. Details: In the case when bounding boxes and estimated areas and spot checks of winding numbers all indicate that this is inside of other_f, an additional time consuming intersection check is performed when this->FigureOrientation() == other_f->FigureOrientation(). When this->FigureOrientation() and other_f->FigureOrientation() are opposited, the additional intersection check is skipped unless bPerformExtraChecking is true. Returns: True if it is very likely that this is not empty and is inside of other_f. False otherwise Remarks:

◆ IsValidFigure()

bool ON_OutlineFigure::IsValidFigure ( bool  bLogErrors) const

◆ NegateY()

bool ON_OutlineFigure::NegateY ( )

◆ operator=()

ON_OutlineFigure& ON_OutlineFigure::operator= ( const ON_OutlineFigure )
default

◆ OrientationToWideString()

static const wchar_t* ON_OutlineFigure::OrientationToWideString ( ON_OutlineFigure::Orientation  orientation)
static

◆ ReverseFigure()

bool ON_OutlineFigure::ReverseFigure ( )

◆ UnitsPerEM()

ON__UINT32 ON_OutlineFigure::UnitsPerEM ( ) const

◆ WindingNumber()

int ON_OutlineFigure::WindingNumber ( ON_2fPoint  winding_point) const

Friends And Related Function Documentation

◆ ON_Outline

friend class ON_Outline
friend

Member Data Documentation

◆ m_figure_index

ON__UINT16 ON_OutlineFigure::m_figure_index = 0

◆ m_points

ON_SimpleArray<ON_OutlineFigurePoint> ON_OutlineFigure::m_points

◆ Unset

const ON_OutlineFigure ON_OutlineFigure::Unset
static