|
Rhino C++ API
9.0
|
A "kink" in a curve is a unit tangent discontinuity or a vector curvature discontinuity. This class is used to determine which types and magnitudes of unit tangent discontinuities and vector curvature discontinuities should are a "kink." It also provides functions for determining if there is a kink at a specific curve parameter. More...
#include <opennurbs_curve.h>
Public Member Functions | |
| ON_CurveKinkDefinition ()=default | |
| ON_CurveKinkDefinition (const ON_CurveKinkDefinition &)=default | |
| ON_CurveKinkDefinition (double kink_angle_degrees, double curvature_kink_radius_ratio, bool bKinkAtTangentChange, bool bKinkAtCurvatureChange) | |
| Create a ON_CurveKinkDefinition with specified settings. More... | |
| ~ON_CurveKinkDefinition ()=default | |
| void | Clear () |
| Clear() disables finding kinks. The current values of TangentKinkAngleDegrees(true), TangentKinkAngleDegrees(false), CurvatureKinkAngleDegrees() and CurvatureKinkRadiusRatio() are not changed. More... | |
| void | ClearCurvatureKinkRadiusRatio () |
| Clears any customized the curature kink radius ratio. More... | |
| void | ClearKinkAngle () |
| Clears any customized kink angle. More... | |
| void | ClearKinkAtCurvatureChange () |
| ClearKinkAtCurvatureChange() disables finding kinks at curvature discontinuities. The current values of CurvatureKinkAngleDegrees() and CurvatureKinkRadiusRatio() are not changed. More... | |
| void | ClearKinkAtTangentChange () |
| ClearKinkAtTangentChange() disables finding kinks at tangent discontinuities. The current value of KinkAngleDegrees() is not changed. More... | |
| bool | ComputeCurvatureRadiusRatio (const ON_3dVector &k0, const ON_3dVector &k1, double &curvatureRadiusRatio, double &angleDegrees) const |
| Calculates the curvature radius ratio and the angle between the two curvature vectors. More... | |
| double | CurvatureKinkRadiusRatio () const |
| If the ratio (minimum radius of curvature)/(maximum radius of curvature) at a curvature discontinuity is < CurvatureKinkRadiusRatio(), then that curvature discontinuity is treated as a kink. In particular, if CurvatureKinkRadiusRatio() = 0, then curvature radius discontinuity checks are disabled. More... | |
| double | CurvatureKinkZeroTolerance () const |
| If the curvature <= CurvatureKinkZeroTolerance(), then it is treated as zero curvature. Put another way, if (radius of curvature) * CurvatureKinkZeroTolerance() >= 1, then the radius is treated as infinite. If CurvatureKinkZeroTolerance() > 0, then the curvature kink test is scale dependent. If CurvatureKinkZeroTolerance() = 0, then the curvature kink test is indpendent of scale. More... | |
| const ON_SHA1_Hash | Hash () const |
| Returns a hash of the settings used to determine if a discontinuity is a kink. This hash is useful for detecting changes in kink settings. If the hashes are equal, then the same kinks will be found. If the hashes are not equal, then curves exist where the different values of ON_CurveKinkDefinition will find different sets of kinks in the same curve. More... | |
| bool | IsCurvatureKink (const ON_Curve &curve, double t) const |
| bool | IsCurvatureKink (ON_3dVector curvature_from_below, ON_3dVector curvature_from_above) const |
| True if the angle between curvature_from_below and curvature_from_above is > CurvatureKinkAngleDegrees() or the ratio min/max < CurvatureKinkRadiusRatio(), where min and max are the minimum and maximum lengths of curvature_from_below and curvature_from_above. Both of these tests are scale independent. If an input curvature vector has length <= CurvatureKinkZeroTolerance(), then that curvature is treated as zero. When is CurvatureKinkZeroTolerance() > 0, the test is scale dependent. The default value is chosen to work reasonably well for most models at most scales. More... | |
| bool | IsCurvatureZero (const ON_3dVector &K) const |
| Returns true if the curvature vector is considered to be zero given the ON_CurveKinkDefinition::CurvatureKinkZeroTolerance More... | |
| bool | IsCurvatureZero (double kappa) const |
| Returns true if the curvature value is considerd to be zero given the ON_CurveKinkDefinition::CurvatureKinkZeroTolerance More... | |
| bool | IsKink (const ON_Curve &curve, double t) const |
| bool | IsSet () const |
| bool | IsTangentKink (const ON_Curve &curve, double t) const |
| bool | IsTangentKink (ON_3dVector tangent_from_below, ON_3dVector tangent_from_above) const |
| bool | IsUnset () const |
| double | KinkAngleDegrees () const |
| The angle, in degrees, used to determine if when an abrupt change in tangent or curvature vector direction is a kink. More... | |
| double | KinkAngleRadians () const |
| The angle, in radians, used to determine if when an abrupt change in tangent or curvature vector direction is a kink. More... | |
| bool | KinkAtCurvatureChange () const |
| bool | KinkAtTangentChange () const |
| ON_CurveKinkDefinition & | operator= (const ON_CurveKinkDefinition &)=default |
| bool | Read (class ON_BinaryArchive &) |
| Read the settings from a binary More... | |
| void | SetCurvatureKinkRadiusRatio (double curvature_kink_radius_ratio) |
| void | SetCurvatureKinkZeroTolerance (double curvature_kink_zero_tolerance) |
| When CurvatureKinkZeroTolerance() is > 0, IsCurvatureKink() is scale dependent. Otherwise all the tests performed by ON_CurveKinkDefinition are independent of scale. The default value ON_CurveKinkDefinition::DefaultCurvatureKinkZeroTolerance > 0. If you know of a finite radius R that should be considered flat, then calling SetCurvatureKinkZeroTolerance(1.0/R) is a reasonable thing to consider. If you want a "mathematically perfect" scale independent test, then call SetCurvatureKinkZeroTolerance(0) to disable this test that is useful in many typical modeling situations. More... | |
| void | SetKinkAngleDegrees (double kink_angle_degrees) |
| The angle, in degrees, used to determine if when an abrupt change in tangent or curvature vector direction is a kink. More... | |
| void | SetKinkAngleRadians (double kink_angle_radians) |
| The angle, in radians, used to determine if when an abrupt change in tangent or curvature vector direction is a kink. More... | |
| void | SetKinkAtCurvatureChange (bool bKinkAtCurvatureChange) |
| void | SetKinkAtTangentChange (bool bKinkAtTangentChange) |
| const ON_wString | ToString () const |
| bool | Write (class ON_BinaryArchive &) const |
| Save the settings in a binary archive. More... | |
Static Public Attributes | |
| static const ON_CurveKinkDefinition | DefaultCurvatureKink |
| DefaultCurvatureKink = MediumCurvatureKink. More... | |
| static constexpr double | DefaultCurvatureKinkRadiusRatio = 0.75 |
| static constexpr double | DefaultCurvatureKinkZeroTolerance = 0.0 |
| DefaultCurvatureKinkZeroTolerance is the default value for CurvatureKinkZeroTolerance(). The default can be overridden by calling SetCurvatureKinkZeroTolerance(). If the length of a curvature vector is <= CurvatureKinkZeroTolerance(), then that curvature vector is treated as zero. Thus, if CurvatureKinkZeroTolerance() = 0, then the setting does nothing. When CurvatureKinkZeroTolerance() > 0, this is a scale dependent test. The default setting is 0. More... | |
| static constexpr double | DefaultKinkAngleDegrees = 1.0 |
| static constexpr double | DefaultKinkAngleRadians = 1.0 * ON_DEGREES_TO_RADIANS |
| static const ON_CurveKinkDefinition | DefaultTangentKink |
| DefaultTangentKink can be used to detect typical tangent discontinuties. The angles used for testing tangent discontinuities are DefaultPolylineTangentKinkAngleDegrees for polylines and DefaultTangentKinkAngleDegrees for all other curves. More... | |
| static const ON_CurveKinkDefinition | LargeCurvatureKink |
| LargeCurvatureKink is used to detect typical unit tangent discontinuties and large vector curvature discontinuties. The angle used for testing tangent discontinuities is DefaultKinkAngleDegrees. The angle used for testing curvature vector direction discontinuties is DefaultKinkAngleDegrees. The ratio used for testing curvature radius discontinuities is LargeCurvatureKinkRadiusRatio. More... | |
| static constexpr double | LargeCurvatureKinkRadiusRatio = 0.5 |
| static const ON_CurveKinkDefinition | MediumCurvatureKink |
| MediumCurvatureKink is used to detect typical unit tangent discontinuties and medium vector curvature discontinuties. The angle used for testing tangent discontinuities is DefaultKinkAngleDegrees. The angle used for testing curvature vector direction discontinuties is DefaultKinkAngleDegrees. The ratio used for testing curvature radius discontinuities is MediumCurvatureKinkRadiusRatio. More... | |
| static constexpr double | MediumCurvatureKinkRadiusRatio = 0.75 |
| static const ON_CurveKinkDefinition | SmallCurvatureKink |
| SmallCurvatureKink is used to detect typical unit tangent discontinuties and small vector curvature discontinuties. The angle used for testing tangent discontinuities is DefaultKinkAngleDegrees. The angle used for testing curvature vector direction discontinuties is DefaultKinkAngleDegrees. The ratio used for testing curvature radius discontinuities is SmallCurvatureKinkRadiusRatio. More... | |
| static constexpr double | SmallCurvatureKinkRadiusRatio = 0.999 |
| static const ON_CurveKinkDefinition | Unset |
A "kink" in a curve is a unit tangent discontinuity or a vector curvature discontinuity. This class is used to determine which types and magnitudes of unit tangent discontinuities and vector curvature discontinuities should are a "kink." It also provides functions for determining if there is a kink at a specific curve parameter.
|
default |
|
default |
|
default |
| ON_CurveKinkDefinition::ON_CurveKinkDefinition | ( | double | kink_angle_degrees, |
| double | curvature_kink_radius_ratio, | ||
| bool | bKinkAtTangentChange, | ||
| bool | bKinkAtCurvatureChange | ||
| ) |
Create a ON_CurveKinkDefinition with specified settings.
| kink_angle_degrees | 0 <= kink_angle_degrees <= 180. Values > 180 are treated as 180 and other values outside the [0,180] are treated as ON_CurveKinkDefinition::DefaultPolylineTangentKinkAngleDegrees. If a curve is a polyline and the angle (in degrees) between the tangents at a tangent discontinuity is > polyline_tangent_kink_angle_degrees, then that discontinuity is treated as a kink. In particular, passing 180.0 disables tangent discontinuity checks for polyline curves. |
| curvature_kink_radius_ratio | 0 <= curvature_kink_radius_ratio <= 1. Values > 1 are treated as 1 and other values outside the [0,1] are treated as ON_CurveKinkDefinition::DefaultCurvatureKinkRadiusRatio. If the ratio (minimum radius of curvature)/(maximum radius of curvature) at a curvature discontinuity is < curvature_kink_radius_ratio, then that discontinuity is treated as a kink. In particular, passing 0.0 disables curvature radius discontinuity checks. |
| bKinkAtTangentChange | true if tangent discontinuities should be tested to determine if the tangent discontinuity is a kink. false to ignore tangent discontinuities. |
| bKinkAtCurvatureChange | true if curvature discontinuities should be tested to determine if the curvature discontinuity is a kink. false to ignore curvature discontinuities. |
| void ON_CurveKinkDefinition::Clear | ( | ) |
Clear() disables finding kinks. The current values of TangentKinkAngleDegrees(true), TangentKinkAngleDegrees(false), CurvatureKinkAngleDegrees() and CurvatureKinkRadiusRatio() are not changed.
| void ON_CurveKinkDefinition::ClearCurvatureKinkRadiusRatio | ( | ) |
Clears any customized the curature kink radius ratio.
| void ON_CurveKinkDefinition::ClearKinkAngle | ( | ) |
Clears any customized kink angle.
| void ON_CurveKinkDefinition::ClearKinkAtCurvatureChange | ( | ) |
ClearKinkAtCurvatureChange() disables finding kinks at curvature discontinuities. The current values of CurvatureKinkAngleDegrees() and CurvatureKinkRadiusRatio() are not changed.
| void ON_CurveKinkDefinition::ClearKinkAtTangentChange | ( | ) |
ClearKinkAtTangentChange() disables finding kinks at tangent discontinuities. The current value of KinkAngleDegrees() is not changed.
| bool ON_CurveKinkDefinition::ComputeCurvatureRadiusRatio | ( | const ON_3dVector & | k0, |
| const ON_3dVector & | k1, | ||
| double & | curvatureRadiusRatio, | ||
| double & | angleDegrees | ||
| ) | const |
Calculates the curvature radius ratio and the angle between the two curvature vectors.
| k0 | |
| k1 | |
| curvatureRadiusRatio | |
| angleDegrees | If one or both of the vectors have zero length, this returns ON_UNSET_VALUE |
| double ON_CurveKinkDefinition::CurvatureKinkRadiusRatio | ( | ) | const |
If the ratio (minimum radius of curvature)/(maximum radius of curvature) at a curvature discontinuity is < CurvatureKinkRadiusRatio(), then that curvature discontinuity is treated as a kink. In particular, if CurvatureKinkRadiusRatio() = 0, then curvature radius discontinuity checks are disabled.
| double ON_CurveKinkDefinition::CurvatureKinkZeroTolerance | ( | ) | const |
If the curvature <= CurvatureKinkZeroTolerance(), then it is treated as zero curvature. Put another way, if (radius of curvature) * CurvatureKinkZeroTolerance() >= 1, then the radius is treated as infinite. If CurvatureKinkZeroTolerance() > 0, then the curvature kink test is scale dependent. If CurvatureKinkZeroTolerance() = 0, then the curvature kink test is indpendent of scale.
| const ON_SHA1_Hash ON_CurveKinkDefinition::Hash | ( | ) | const |
Returns a hash of the settings used to determine if a discontinuity is a kink. This hash is useful for detecting changes in kink settings. If the hashes are equal, then the same kinks will be found. If the hashes are not equal, then curves exist where the different values of ON_CurveKinkDefinition will find different sets of kinks in the same curve.
| bool ON_CurveKinkDefinition::IsCurvatureKink | ( | const ON_Curve & | curve, |
| double | t | ||
| ) | const |
| bool ON_CurveKinkDefinition::IsCurvatureKink | ( | ON_3dVector | curvature_from_below, |
| ON_3dVector | curvature_from_above | ||
| ) | const |
True if the angle between curvature_from_below and curvature_from_above is > CurvatureKinkAngleDegrees() or the ratio min/max < CurvatureKinkRadiusRatio(), where min and max are the minimum and maximum lengths of curvature_from_below and curvature_from_above. Both of these tests are scale independent. If an input curvature vector has length <= CurvatureKinkZeroTolerance(), then that curvature is treated as zero. When is CurvatureKinkZeroTolerance() > 0, the test is scale dependent. The default value is chosen to work reasonably well for most models at most scales.
| curvature_from_below | |
| curvature_from_above |
| bool ON_CurveKinkDefinition::IsCurvatureZero | ( | const ON_3dVector & | K | ) | const |
Returns true if the curvature vector is considered to be zero given the ON_CurveKinkDefinition::CurvatureKinkZeroTolerance
| K |
| bool ON_CurveKinkDefinition::IsCurvatureZero | ( | double | kappa | ) | const |
Returns true if the curvature value is considerd to be zero given the ON_CurveKinkDefinition::CurvatureKinkZeroTolerance
| kappa |
| bool ON_CurveKinkDefinition::IsKink | ( | const ON_Curve & | curve, |
| double | t | ||
| ) | const |
| bool ON_CurveKinkDefinition::IsSet | ( | ) | const |
| bool ON_CurveKinkDefinition::IsTangentKink | ( | const ON_Curve & | curve, |
| double | t | ||
| ) | const |
| bool ON_CurveKinkDefinition::IsTangentKink | ( | ON_3dVector | tangent_from_below, |
| ON_3dVector | tangent_from_above | ||
| ) | const |
| bool ON_CurveKinkDefinition::IsUnset | ( | ) | const |
| double ON_CurveKinkDefinition::KinkAngleDegrees | ( | ) | const |
The angle, in degrees, used to determine if when an abrupt change in tangent or curvature vector direction is a kink.
| double ON_CurveKinkDefinition::KinkAngleRadians | ( | ) | const |
The angle, in radians, used to determine if when an abrupt change in tangent or curvature vector direction is a kink.
| bool ON_CurveKinkDefinition::KinkAtCurvatureChange | ( | ) | const |
| bool ON_CurveKinkDefinition::KinkAtTangentChange | ( | ) | const |
|
default |
| bool ON_CurveKinkDefinition::Read | ( | class ON_BinaryArchive & | ) |
Read the settings from a binary
| void ON_CurveKinkDefinition::SetCurvatureKinkRadiusRatio | ( | double | curvature_kink_radius_ratio | ) |
| curvature_kink_radius_ratio | 0 <= curvature_kink_radius_ratio <= 1. Values > 1 are treated as 1 and other values outside the [0,1] are treated as ON_CurveKinkDefinition::DefaultCurvatureKinkRadiusRatio. If the ratio (minimum radius of curvature)/(maximum radius of curvature) at a curvature discontinuity is < curvature_kink_radius_ratio, then that discontinuity is treated as a kink. In particular, passing 0.0 disables curvature radius discontinuity checks. |
| void ON_CurveKinkDefinition::SetCurvatureKinkZeroTolerance | ( | double | curvature_kink_zero_tolerance | ) |
When CurvatureKinkZeroTolerance() is > 0, IsCurvatureKink() is scale dependent. Otherwise all the tests performed by ON_CurveKinkDefinition are independent of scale. The default value ON_CurveKinkDefinition::DefaultCurvatureKinkZeroTolerance > 0. If you know of a finite radius R that should be considered flat, then calling SetCurvatureKinkZeroTolerance(1.0/R) is a reasonable thing to consider. If you want a "mathematically perfect" scale independent test, then call SetCurvatureKinkZeroTolerance(0) to disable this test that is useful in many typical modeling situations.
| curvature_zero_tolerance | 0 <= curvature_zero_tolerance Negative and non-finite values are treated as ON_CurveKinkDefinition::DefaultCurvatureKinkZeroTolerance. If the length of a curvature vector is <= curvature_zero_tolerance, then that curvature is treated as zero. In particular, passing 0.0 disables curvature zero tolerance checks. |
| void ON_CurveKinkDefinition::SetKinkAngleDegrees | ( | double | kink_angle_degrees | ) |
The angle, in degrees, used to determine if when an abrupt change in tangent or curvature vector direction is a kink.
| kink_angle_degrees | 0 <= kink_angle_degrees <= 180. Values > 180 are treated as 180 and other values outside the [0,180] are treated as ON_CurveKinkDefinition::DefaultKinkAngleDegrees. |
| void ON_CurveKinkDefinition::SetKinkAngleRadians | ( | double | kink_angle_radians | ) |
The angle, in radians, used to determine if when an abrupt change in tangent or curvature vector direction is a kink.
| kink_angle_radians | 0 <= kink_angle_radians <= 180. Values > 180 are treated as 180 and other values outside the [0,180] are treated as ON_CurveKinkDefinition::DefaultKinkAngleRadians. |
| void ON_CurveKinkDefinition::SetKinkAtCurvatureChange | ( | bool | bKinkAtCurvatureChange | ) |
| bKinkAtTangentChange | If true, finding kinks at curvature discontinuities is enabled. If the curvature parameters are not set, then ON_CurveKinkDefinition::DefaulteKinkAngleDegrees and ON_CurveKinkDefinition::DefaultCurvatureKinkRadiusRatio are used. If false, then curvature discontinuities are ignored when finding kinks. The current values of CurvatureKinkAngleDegrees() and CurvatureKinkRadiusRatio() are not changed. |
| void ON_CurveKinkDefinition::SetKinkAtTangentChange | ( | bool | bKinkAtTangentChange | ) |
| bKinkAtTangentChange | If true, finding kinks at tangent discontinuities is enabled. If the kink angles are not set, then ON_CurveKinkDefinition::DefaultKinkAngleDegrees is used. If false, then tangent discontinuities are ignored when finding kinks. The current value of KinkAngleDegrees() is not changed. |
| const ON_wString ON_CurveKinkDefinition::ToString | ( | ) | const |
| bool ON_CurveKinkDefinition::Write | ( | class ON_BinaryArchive & | ) | const |
Save the settings in a binary archive.
|
static |
DefaultCurvatureKink = MediumCurvatureKink.
|
staticconstexpr |
|
staticconstexpr |
DefaultCurvatureKinkZeroTolerance is the default value for CurvatureKinkZeroTolerance(). The default can be overridden by calling SetCurvatureKinkZeroTolerance(). If the length of a curvature vector is <= CurvatureKinkZeroTolerance(), then that curvature vector is treated as zero. Thus, if CurvatureKinkZeroTolerance() = 0, then the setting does nothing. When CurvatureKinkZeroTolerance() > 0, this is a scale dependent test. The default setting is 0.
1e-8;
|
staticconstexpr |
|
staticconstexpr |
|
static |
DefaultTangentKink can be used to detect typical tangent discontinuties. The angles used for testing tangent discontinuities are DefaultPolylineTangentKinkAngleDegrees for polylines and DefaultTangentKinkAngleDegrees for all other curves.
|
static |
LargeCurvatureKink is used to detect typical unit tangent discontinuties and large vector curvature discontinuties. The angle used for testing tangent discontinuities is DefaultKinkAngleDegrees. The angle used for testing curvature vector direction discontinuties is DefaultKinkAngleDegrees. The ratio used for testing curvature radius discontinuities is LargeCurvatureKinkRadiusRatio.
|
staticconstexpr |
|
static |
MediumCurvatureKink is used to detect typical unit tangent discontinuties and medium vector curvature discontinuties. The angle used for testing tangent discontinuities is DefaultKinkAngleDegrees. The angle used for testing curvature vector direction discontinuties is DefaultKinkAngleDegrees. The ratio used for testing curvature radius discontinuities is MediumCurvatureKinkRadiusRatio.
|
staticconstexpr |
|
static |
SmallCurvatureKink is used to detect typical unit tangent discontinuties and small vector curvature discontinuties. The angle used for testing tangent discontinuities is DefaultKinkAngleDegrees. The angle used for testing curvature vector direction discontinuties is DefaultKinkAngleDegrees. The ratio used for testing curvature radius discontinuities is SmallCurvatureKinkRadiusRatio.
|
staticconstexpr |
|
static |
1.8.17