iText 8.0.2 API
iText.Kernel.Geom.Vector Class Reference

Represents a vector (i.e. a point in space). More...

Public Member Functions

  Vector (float x, float y, float z)
  Creates a new Vector More...
 
virtual float  Get (int index)
  Gets the value from a coordinate of the vector More...
 
virtual iText.Kernel.Geom.Vector  Cross (Matrix by)
  Computes the cross product of this vector and the specified matrix More...
 
virtual iText.Kernel.Geom.Vector  Subtract (iText.Kernel.Geom.Vector v)
  Computes the difference between this vector and the specified vector More...
 
virtual iText.Kernel.Geom.Vector  Cross (iText.Kernel.Geom.Vector with)
  Computes the cross product of this vector and the specified vector More...
 
virtual iText.Kernel.Geom.Vector  Normalize ()
  Normalizes the vector (i.e. returns the unit vector in the same orientation as this vector) More...
 
virtual iText.Kernel.Geom.Vector  Multiply (float by)
  Multiplies the vector by a scalar More...
 
virtual float  Dot (iText.Kernel.Geom.Vector with)
  Computes the dot product of this vector with the specified vector More...
 
virtual float  Length ()
  Computes the length of this vector More...
 
virtual float  LengthSquared ()
  Computes the length squared of this vector. More...
 
override String  ToString ()
 
See also
System.Object.ToString()

 
override int  GetHashCode ()
  Calculates the hashcode using the values. More...
 
override bool  Equals (Object obj)
 
See also
System.Object.Equals(System.Object)

 

Static Public Attributes

const int  I1 = 0
  index of the X coordinate More...
 
const int  I2 = 1
  index of the Y coordinate More...
 
const int  I3 = 2
  index of the Z coordinate More...
 

Detailed Description

Represents a vector (i.e. a point in space).

Represents a vector (i.e. a point in space). This class is completely unrelated to the System.Collections.ArrayList class in the standard JRE.

For many PDF related operations, the z coordinate is specified as 1 This is to support the coordinate transformation calculations. If it helps, just think of all PDF drawing operations as occurring in a single plane with z=1.

Constructor & Destructor Documentation

◆ Vector()

iText.Kernel.Geom.Vector.Vector ( float  x,
float  y,
float  z 
)
inline

Creates a new Vector

Parameters
x the X coordinate
y the Y coordinate
z the Z coordinate

Member Function Documentation

◆ Cross() [1/2]

virtual iText.Kernel.Geom.Vector iText.Kernel.Geom.Vector.Cross ( iText.Kernel.Geom.Vector  with )
inlinevirtual

Computes the cross product of this vector and the specified vector

Parameters
with the vector to cross this vector with
Returns
the cross product

◆ Cross() [2/2]

virtual iText.Kernel.Geom.Vector iText.Kernel.Geom.Vector.Cross ( Matrix  by )
inlinevirtual

Computes the cross product of this vector and the specified matrix

Parameters
by the matrix to cross this vector with
Returns
the result of the cross product

◆ Dot()

virtual float iText.Kernel.Geom.Vector.Dot ( iText.Kernel.Geom.Vector  with )
inlinevirtual

Computes the dot product of this vector with the specified vector

Parameters
with the vector to dot product this vector with
Returns
the dot product

◆ Get()

virtual float iText.Kernel.Geom.Vector.Get ( int  index )
inlinevirtual

Gets the value from a coordinate of the vector

Parameters
index the index of the value to get (I1, I2 or I3)
Returns
a coordinate value

◆ GetHashCode()

override int iText.Kernel.Geom.Vector.GetHashCode ( )
inline

Calculates the hashcode using the values.

◆ Length()

virtual float iText.Kernel.Geom.Vector.Length ( )
inlinevirtual

Computes the length of this vector

Computes the length of this vector
Note: If you are working with raw vectors from PDF, be careful - the Z axis will generally be set to 1. If you want to compute the length of a vector, subtract it from the origin first (this will set the Z axis to 0).
For example: aVector.subtract(originVector).length();

Returns
the length of this vector

◆ LengthSquared()

virtual float iText.Kernel.Geom.Vector.LengthSquared ( )
inlinevirtual

Computes the length squared of this vector.

Computes the length squared of this vector. The square of the length is less expensive to compute, and is often useful without taking the square root.

Note: See the important note under Length()

Returns
the square of the length of the vector

◆ Multiply()

virtual iText.Kernel.Geom.Vector iText.Kernel.Geom.Vector.Multiply ( float  by )
inlinevirtual

Multiplies the vector by a scalar

Parameters
by the scalar to multiply by
Returns
the result of the scalar multiplication

◆ Normalize()

virtual iText.Kernel.Geom.Vector iText.Kernel.Geom.Vector.Normalize ( )
inlinevirtual

Normalizes the vector (i.e. returns the unit vector in the same orientation as this vector)

Returns
the unit vector

◆ Subtract()

virtual iText.Kernel.Geom.Vector iText.Kernel.Geom.Vector.Subtract ( iText.Kernel.Geom.Vector  v )
inlinevirtual

Computes the difference between this vector and the specified vector

Parameters
v the vector to subtract from this one
Returns
the results of the subtraction

Member Data Documentation

◆ I1

const int iText.Kernel.Geom.Vector.I1 = 0
static

index of the X coordinate

◆ I2

const int iText.Kernel.Geom.Vector.I2 = 1
static

index of the Y coordinate

◆ I3

const int iText.Kernel.Geom.Vector.I3 = 2
static

index of the Z coordinate