Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More consistent behavior between ON_Arc::SetAngleRadians() and ON_Arc… #55

Open
wants to merge 1 commit into
base: 7.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions opennurbs_arc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,24 @@ ON_Interval ON_Arc::DomainDegrees() const

bool ON_Arc::SetAngleRadians( double a )
{
ON_Interval angles;
if ( a < 0.0 )
{
double a0 = m_angle.m_t[0];
m_angle.Set(a0+a,a0);
angles.Set(a0+a,a0);
Reverse();
}
else
{
m_angle.m_t[1] = m_angle.m_t[0] + a;
double a0 = m_angle.m_t[0];
angles.Set(a0, a0+a);
}
return ( fabs(m_angle.Length()) <= 2.0*ON_PI ) ? true : false;
return SetAngleIntervalRadians(angles);
}

bool ON_Arc::SetAngleIntervalRadians( ON_Interval angle_in_radians )
{
bool rc = angle_in_radians.IsIncreasing()
bool rc = (angle_in_radians.IsIncreasing() || angle_in_radians.Length() < ON_EPSILON)
&& angle_in_radians.Length() < (1.0+ON_SQRT_EPSILON)*2.0*ON_PI;
if (rc)
{
Expand Down
13 changes: 8 additions & 5 deletions opennurbs_arc.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,14 @@ class ON_CLASS ON_Arc : public ON_Circle
// The arc's domain in degrees.
ON_Interval DomainDegrees() const;

// Description:
// Set arc's subtended angle in radians.
// Parameters:
// angle_in_radians - [in] 0 <= angle_in_radians <= 2.0*ON_PI
//
/*
Description:
Set arc's subtended angle in radians.
Parameters:
angle_in_radians - [in] 0 <= angle_in_radians <= 2.0*ON_PI
Returns:
true if successful.
*/
bool SetAngleRadians(
double angle_in_radians
);
Expand Down