JX Application Framework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
JVector Class Reference

#include <JVector.h>

Public Member Functions

 JVector (const JSize dimCount, const JFloat fillValue=0.0)
 
 JVector (const JSize dimCount, const JFloat values[])
 
 JVector (const JSize dimCount, const JFloat v1, const JFloat v2,...)
 
 JVector (const JVector &source)
 
 ~JVector ()
 
JVectoroperator= (const JVector &)
 
JVectoroperator+= (const JVector &)
 
JVectoroperator-= (const JVector &)
 
JVectoroperator*= (const JFloat)
 
JVectoroperator/= (const JFloat)
 
JVector operator- () const
 
JSize GetDimensionCount () const
 
JFloat GetElement (const JIndex index) const
 
void SetElement (const JIndex index, const JFloat value)
 
void IncrementElement (const JIndex index, const JFloat delta)
 
void SetAllElements (const JFloat value)
 
const JFloatGetElements () const
 
void Set (const JFloat values[])
 
void Set (const JFloat v1,...)
 
JFloat GetMinElement (JIndex *index=nullptr) const
 
JFloat GetMaxElement (JIndex *index=nullptr) const
 
JFloat GetLength () const
 
JMatrix Transpose () const
 
void Normalize ()
 
JVector UnitVector () const
 

Detailed Description

Class to represent a column vector.  To get a row vector, use transpose.

This class was not designed to be a base class!  If you need to override it,
be sure to make the destructor virtual.

Constructor & Destructor Documentation

◆ JVector() [1/4]

JVector::JVector ( const JSize  dimCount,
const JFloat  fillValue = 0.0 
)

The third form needs 3 arguments to distinguish it from the first form.

The 3rd form does not promote types, so passing 0 will not work.
You must enter 0.0 so it is passed as a JFloat.

◆ JVector() [2/4]

JVector::JVector ( const JSize  dimCount,
const JFloat  values[] 
)

◆ JVector() [3/4]

JVector::JVector ( const JSize  dimCount,
const JFloat  v1,
const JFloat  v2,
  ... 
)

◆ JVector() [4/4]

JVector::JVector ( const JVector source)

◆ ~JVector()

JVector::~JVector ( )

Member Function Documentation

◆ GetDimensionCount()

JSize JVector::GetDimensionCount ( ) const
inline

◆ GetElement()

JFloat JVector::GetElement ( const JIndex  index) const

◆ GetElements()

const JFloat * JVector::GetElements ( ) const
inline

◆ GetLength()

JFloat JVector::GetLength ( ) const

Return our Euclidean length.

◆ GetMaxElement()

JFloat JVector::GetMaxElement ( JIndex index = nullptr) const

Returns the maximum element. If index != nullptr, it contains the index of the element that is returned.

◆ GetMinElement()

JFloat JVector::GetMinElement ( JIndex index = nullptr) const

Returns the minimum element. If index != nullptr, it contains the index of the element that is returned.

◆ IncrementElement()

void JVector::IncrementElement ( const JIndex  index,
const JFloat  delta 
)

Adds the given value to the specified element.

◆ Normalize()

void JVector::Normalize ( )
inline

◆ operator*=()

JVector & JVector::operator*= ( const JFloat  s)

◆ operator+=()

JVector & JVector::operator+= ( const JVector v)

◆ operator-()

JVector JVector::operator- ( ) const

◆ operator-=()

JVector & JVector::operator-= ( const JVector v)

◆ operator/=()

JVector & JVector::operator/= ( const JFloat  s)

◆ operator=()

JVector & JVector::operator= ( const JVector source)

◆ Set() [1/2]

void JVector::Set ( const JFloat  v1,
  ... 
)

◆ Set() [2/2]

void JVector::Set ( const JFloat  values[])

The number of elements passed in is assumed to be equal to the vector's size.

◆ SetAllElements()

void JVector::SetAllElements ( const JFloat  value)

◆ SetElement()

void JVector::SetElement ( const JIndex  index,
const JFloat  value 
)

◆ Transpose()

JMatrix JVector::Transpose ( ) const

◆ UnitVector()

JVector JVector::UnitVector ( ) const

Return a unit vector in the same direction as ourselves.


The documentation for this class was generated from the following files: