Rhino C++ API  7.24
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ON_2fVector Class Reference

#include <opennurbs_fpoint.h>

Public Member Functions

 ON_2fVector ()=default
 x,y not initialized More...
 
 ON_2fVector (const double *)
 from double[2] array More...
 
 ON_2fVector (const float *)
 from float[2] array More...
 
 ON_2fVector (const ON_2dPoint &)
 from 2d point More...
 
 ON_2fVector (const ON_2dVector &)
 from 2d vector More...
 
 ON_2fVector (const ON_2fPoint &)
 from 2f point More...
 
 ON_2fVector (const ON_2fVector &)=default
 
 ON_2fVector (const ON_3dPoint &)
 from 3d point More...
 
 ON_2fVector (const ON_3dVector &)
 from 3d vector More...
 
 ON_2fVector (const ON_3fPoint &)
 from 3f point More...
 
 ON_2fVector (const ON_3fVector &)
 from 3f vector More...
 
 ON_2fVector (float x, float y)
 
 ~ON_2fVector ()=default
 
ON__UINT32 DataCRC (ON__UINT32 current_remainder) const
 
bool Decompose (const ON_2fVector &, const ON_2fVector &, double *, double *) const
 
bool IsNotZero () const
 
int IsParallelTo (const ON_2fVector &, double=ON_DEFAULT_ANGLE_TOLERANCE) const
 
bool IsPerpendicularTo (const ON_2fVector &, double=ON_DEFAULT_ANGLE_TOLERANCE) const
 
bool IsTiny (double=ON_ZERO_TOLERANCE) const
 
bool IsUnitVector () const
 
bool IsUnset () const
 
bool IsValid () const
 
bool IsZero () const
 
double Length () const
 
double LengthSquared () const
 
double MaximumCoordinate () const
 absolute value of maximum coordinate More...
 
int MaximumCoordinateIndex () const
 
 operator const float * () const
 
 operator float * ()
 (float*) conversion operators More...
 
bool operator!= (const ON_2fVector &) const
 
double operator* (const ON_2dVector &) const
 inner (dot) product More...
 
float operator* (const ON_2fPoint &) const
 inner (dot) product point acting as a vector More...
 
float operator* (const ON_2fVector &) const
 inner (dot) product More...
 
ON_2dVector operator* (double) const
 
ON_2fVector operator* (float) const
 
ON_2fVector operator* (int) const
 
ON_2fVectoroperator*= (float)
 
ON_2dPoint operator+ (const ON_2dPoint &) const
 
ON_2dVector operator+ (const ON_2dVector &) const
 
ON_2fPoint operator+ (const ON_2fPoint &) const
 
ON_2fVector operator+ (const ON_2fVector &) const
 
ON_3dPoint operator+ (const ON_3dPoint &) const
 
ON_3dVector operator+ (const ON_3dVector &) const
 
ON_3fPoint operator+ (const ON_3fPoint &) const
 
ON_3fVector operator+ (const ON_3fVector &) const
 
ON_2fVectoroperator+= (const ON_2fVector &)
 
ON_2fVector operator- () const
 
ON_2dPoint operator- (const ON_2dPoint &) const
 
ON_2dVector operator- (const ON_2dVector &) const
 
ON_2fPoint operator- (const ON_2fPoint &) const
 
ON_2fVector operator- (const ON_2fVector &) const
 
ON_3dPoint operator- (const ON_3dPoint &) const
 
ON_3dVector operator- (const ON_3dVector &) const
 
ON_3fPoint operator- (const ON_3fPoint &) const
 
ON_3fVector operator- (const ON_3fVector &) const
 
ON_2fVectoroperator-= (const ON_2fVector &)
 
ON_2dVector operator/ (double) const
 
ON_2fVector operator/ (float) const
 
ON_2fVector operator/ (int) const
 
ON_2fVectoroperator/= (float)
 
bool operator< (const ON_2fVector &) const
 
bool operator<= (const ON_2fVector &) const
 dictionary order comparisons More...
 
ON_2fVectoroperator= (const double *)
 point = double[2] support More...
 
ON_2fVectoroperator= (const float *)
 point = float[2] support More...
 
ON_2fVectoroperator= (const ON_2dPoint &)
 
ON_2fVectoroperator= (const ON_2dVector &)
 
ON_2fVectoroperator= (const ON_2fPoint &)
 use implicit operator=(const ON_2fVector&) More...
 
ON_2fVectoroperator= (const ON_2fVector &)=default
 
ON_2fVectoroperator= (const ON_3dPoint &)
 
ON_2fVectoroperator= (const ON_3dVector &)
 
ON_2fVectoroperator= (const ON_3fPoint &)
 
ON_2fVectoroperator= (const ON_3fVector &)
 
bool operator== (const ON_2fVector &) const
 
bool operator> (const ON_2fVector &) const
 
bool operator>= (const ON_2fVector &) const
 
float & operator[] (int)
 index operators mimic float[2] behavior More...
 
float operator[] (int) const
 
float & operator[] (unsigned int)
 
float operator[] (unsigned int) const
 
bool PerpendicularTo (const ON_2fPoint &, const ON_2fPoint &)
 set this vector to be perpendicular to a line defined by 2 points More...
 
bool PerpendicularTo (const ON_2fVector &)
 set this vector to be perpendicular to another vector More...
 
void Reverse ()
 negate all coordinates More...
 
void Set (float, float)
 set 2d vector value More...
 
bool Unitize ()
 returns false if vector has zero length More...
 
ON_2fVector UnitVector () const
 
void Zero ()
 set all coordinates to zero; More...
 

Static Public Member Functions

static int Compare (const ON_2fVector &lhs, const ON_2fVector &rhs)
 
static const ON_2fVectorUnitVector (int)
 

Public Attributes

float x
 
float y
 

Static Public Attributes

static const ON_2fVector NanVector
 (ON_FLT_QNAN,ON_FLT_QNAN) More...
 
static const ON_2fVector XAxis
 (1.0f,0.0f) More...
 
static const ON_2fVector YAxis
 (0.0f,1.0f) More...
 
static const ON_2fVector ZeroVector
 (0.0f,0.0f) More...
 

Detailed Description

ON_2fVector

Constructor & Destructor Documentation

◆ ON_2fVector() [1/12]

ON_2fVector::ON_2fVector ( )
default

x,y not initialized

◆ ~ON_2fVector()

ON_2fVector::~ON_2fVector ( )
default

◆ ON_2fVector() [2/12]

ON_2fVector::ON_2fVector ( const ON_2fVector )
default

◆ ON_2fVector() [3/12]

ON_2fVector::ON_2fVector ( float  x,
float  y 
)
explicit

◆ ON_2fVector() [4/12]

ON_2fVector::ON_2fVector ( const ON_2fPoint )
explicit

from 2f point

◆ ON_2fVector() [5/12]

ON_2fVector::ON_2fVector ( const ON_3fPoint )
explicit

from 3f point

◆ ON_2fVector() [6/12]

ON_2fVector::ON_2fVector ( const ON_3fVector )
explicit

from 3f vector

◆ ON_2fVector() [7/12]

ON_2fVector::ON_2fVector ( const float *  )
explicit

from float[2] array

◆ ON_2fVector() [8/12]

ON_2fVector::ON_2fVector ( const ON_2dPoint )
explicit

from 2d point

◆ ON_2fVector() [9/12]

ON_2fVector::ON_2fVector ( const ON_3dPoint )
explicit

from 3d point

◆ ON_2fVector() [10/12]

ON_2fVector::ON_2fVector ( const ON_2dVector )
explicit

from 2d vector

◆ ON_2fVector() [11/12]

ON_2fVector::ON_2fVector ( const ON_3dVector )
explicit

from 3d vector

◆ ON_2fVector() [12/12]

ON_2fVector::ON_2fVector ( const double *  )
explicit

from double[2] array

Member Function Documentation

◆ Compare()

static int ON_2fVector::Compare ( const ON_2fVector lhs,
const ON_2fVector rhs 
)
static

Description: A well ordered dictionary compare function that is nan aware and can be used for robust sorting.

◆ DataCRC()

ON__UINT32 ON_2fVector::DataCRC ( ON__UINT32  current_remainder) const

◆ Decompose()

bool ON_2fVector::Decompose ( const ON_2fVector ,
const ON_2fVector ,
double *  ,
double *   
) const

◆ IsNotZero()

bool ON_2fVector::IsNotZero ( ) const

Returns: true if at lease one coordinate is not zero and no coordinates are unset or nans.

◆ IsParallelTo()

int ON_2fVector::IsParallelTo ( const ON_2fVector ,
double  = ON_DEFAULT_ANGLE_TOLERANCE 
) const

◆ IsPerpendicularTo()

bool ON_2fVector::IsPerpendicularTo ( const ON_2fVector ,
double  = ON_DEFAULT_ANGLE_TOLERANCE 
) const

◆ IsTiny()

bool ON_2fVector::IsTiny ( double  = ON_ZERO_TOLERANCE) const

Description: Test a vector to see if it is very short

Parameters: tiny_tol - [in] (default = ON_ZERO_TOLERANCE) a nonzero value used as the coordinate zero tolerance.

Returns: ( fabs(x) <= tiny_tol && fabs(y) <= tiny_tol )

◆ IsUnitVector()

bool ON_2fVector::IsUnitVector ( ) const

◆ IsUnset()

bool ON_2fVector::IsUnset ( ) const

Returns: True if any coordinate is ON_UNSET_FLOAT or ON_UNSET_POSITIVE_FLOAT

◆ IsValid()

bool ON_2fVector::IsValid ( ) const

Returns: False if any coordinate is ON_UNSET_FLOAT, ON_UNSET_POSITIVE_FLOAT, nan, or infinite. True, otherwise.

◆ IsZero()

bool ON_2fVector::IsZero ( ) const

Returns: true if vector is the zero vector.

◆ Length()

double ON_2fVector::Length ( ) const

◆ LengthSquared()

double ON_2fVector::LengthSquared ( ) const

◆ MaximumCoordinate()

double ON_2fVector::MaximumCoordinate ( ) const

absolute value of maximum coordinate

◆ MaximumCoordinateIndex()

int ON_2fVector::MaximumCoordinateIndex ( ) const

◆ operator const float *()

ON_2fVector::operator const float * ( ) const

◆ operator float *()

ON_2fVector::operator float * ( )

(float*) conversion operators

◆ operator!=()

bool ON_2fVector::operator!= ( const ON_2fVector ) const

◆ operator*() [1/6]

double ON_2fVector::operator* ( const ON_2dVector ) const

inner (dot) product

◆ operator*() [2/6]

float ON_2fVector::operator* ( const ON_2fPoint ) const

inner (dot) product point acting as a vector

◆ operator*() [3/6]

float ON_2fVector::operator* ( const ON_2fVector ) const

inner (dot) product

◆ operator*() [4/6]

ON_2dVector ON_2fVector::operator* ( double  ) const

◆ operator*() [5/6]

ON_2fVector ON_2fVector::operator* ( float  ) const

◆ operator*() [6/6]

ON_2fVector ON_2fVector::operator* ( int  ) const

◆ operator*=()

ON_2fVector& ON_2fVector::operator*= ( float  )

◆ operator+() [1/8]

ON_2dPoint ON_2fVector::operator+ ( const ON_2dPoint ) const

◆ operator+() [2/8]

ON_2dVector ON_2fVector::operator+ ( const ON_2dVector ) const

◆ operator+() [3/8]

ON_2fPoint ON_2fVector::operator+ ( const ON_2fPoint ) const

◆ operator+() [4/8]

ON_2fVector ON_2fVector::operator+ ( const ON_2fVector ) const

◆ operator+() [5/8]

ON_3dPoint ON_2fVector::operator+ ( const ON_3dPoint ) const

◆ operator+() [6/8]

ON_3dVector ON_2fVector::operator+ ( const ON_3dVector ) const

◆ operator+() [7/8]

ON_3fPoint ON_2fVector::operator+ ( const ON_3fPoint ) const

◆ operator+() [8/8]

ON_3fVector ON_2fVector::operator+ ( const ON_3fVector ) const

◆ operator+=()

ON_2fVector& ON_2fVector::operator+= ( const ON_2fVector )

◆ operator-() [1/9]

ON_2fVector ON_2fVector::operator- ( ) const

◆ operator-() [2/9]

ON_2dPoint ON_2fVector::operator- ( const ON_2dPoint ) const

◆ operator-() [3/9]

ON_2dVector ON_2fVector::operator- ( const ON_2dVector ) const

◆ operator-() [4/9]

ON_2fPoint ON_2fVector::operator- ( const ON_2fPoint ) const

◆ operator-() [5/9]

ON_2fVector ON_2fVector::operator- ( const ON_2fVector ) const

◆ operator-() [6/9]

ON_3dPoint ON_2fVector::operator- ( const ON_3dPoint ) const

◆ operator-() [7/9]

ON_3dVector ON_2fVector::operator- ( const ON_3dVector ) const

◆ operator-() [8/9]

ON_3fPoint ON_2fVector::operator- ( const ON_3fPoint ) const

◆ operator-() [9/9]

ON_3fVector ON_2fVector::operator- ( const ON_3fVector ) const

◆ operator-=()

ON_2fVector& ON_2fVector::operator-= ( const ON_2fVector )

◆ operator/() [1/3]

ON_2dVector ON_2fVector::operator/ ( double  ) const

◆ operator/() [2/3]

ON_2fVector ON_2fVector::operator/ ( float  ) const

◆ operator/() [3/3]

ON_2fVector ON_2fVector::operator/ ( int  ) const

◆ operator/=()

ON_2fVector& ON_2fVector::operator/= ( float  )

◆ operator<()

bool ON_2fVector::operator< ( const ON_2fVector ) const

◆ operator<=()

bool ON_2fVector::operator<= ( const ON_2fVector ) const

dictionary order comparisons

◆ operator=() [1/10]

ON_2fVector& ON_2fVector::operator= ( const double *  )

point = double[2] support

◆ operator=() [2/10]

ON_2fVector& ON_2fVector::operator= ( const float *  )

point = float[2] support

◆ operator=() [3/10]

ON_2fVector& ON_2fVector::operator= ( const ON_2dPoint )

◆ operator=() [4/10]

ON_2fVector& ON_2fVector::operator= ( const ON_2dVector )

◆ operator=() [5/10]

ON_2fVector& ON_2fVector::operator= ( const ON_2fPoint )

◆ operator=() [6/10]

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

◆ operator=() [7/10]

ON_2fVector& ON_2fVector::operator= ( const ON_3dPoint )

◆ operator=() [8/10]

ON_2fVector& ON_2fVector::operator= ( const ON_3dVector )

◆ operator=() [9/10]

ON_2fVector& ON_2fVector::operator= ( const ON_3fPoint )

◆ operator=() [10/10]

ON_2fVector& ON_2fVector::operator= ( const ON_3fVector )

◆ operator==()

bool ON_2fVector::operator== ( const ON_2fVector ) const

◆ operator>()

bool ON_2fVector::operator> ( const ON_2fVector ) const

◆ operator>=()

bool ON_2fVector::operator>= ( const ON_2fVector ) const

◆ operator[]() [1/4]

float& ON_2fVector::operator[] ( int  )

index operators mimic float[2] behavior

◆ operator[]() [2/4]

float ON_2fVector::operator[] ( int  ) const

◆ operator[]() [3/4]

float& ON_2fVector::operator[] ( unsigned int  )

◆ operator[]() [4/4]

float ON_2fVector::operator[] ( unsigned int  ) const

◆ PerpendicularTo() [1/2]

bool ON_2fVector::PerpendicularTo ( const ON_2fPoint ,
const ON_2fPoint  
)

set this vector to be perpendicular to a line defined by 2 points

◆ PerpendicularTo() [2/2]

bool ON_2fVector::PerpendicularTo ( const ON_2fVector )

set this vector to be perpendicular to another vector

◆ Reverse()

void ON_2fVector::Reverse ( )

negate all coordinates

Deprecated:
Use v = -v;

◆ Set()

void ON_2fVector::Set ( float  ,
float   
)

set 2d vector value

◆ Unitize()

bool ON_2fVector::Unitize ( )

returns false if vector has zero length

◆ UnitVector() [1/2]

ON_2fVector ON_2fVector::UnitVector ( ) const

Returns: If this is a valid non-zero vector, a unit vector parallel to this is returned. Otherwise the zero vector is returned.

◆ UnitVector() [2/2]

static const ON_2fVector& ON_2fVector::UnitVector ( int  )
static

Description: A index driven function to get unit axis vectors. Parameters: index - [in] 0 returns (1,0), 1 returns (0,1) Returns: Unit 3d vector with vector[i] = (i==index)?1:0;

◆ Zero()

void ON_2fVector::Zero ( )

set all coordinates to zero;

Deprecated:
Use p = ON_2fVector::ZeroVector;

Member Data Documentation

◆ NanVector

const ON_2fVector ON_2fVector::NanVector
static

(ON_FLT_QNAN,ON_FLT_QNAN)

◆ x

float ON_2fVector::x

◆ XAxis

const ON_2fVector ON_2fVector::XAxis
static

(1.0f,0.0f)

◆ y

float ON_2fVector::y

◆ YAxis

const ON_2fVector ON_2fVector::YAxis
static

(0.0f,1.0f)

◆ ZeroVector

const ON_2fVector ON_2fVector::ZeroVector
static

(0.0f,0.0f)