public class

Vec2

extends Object
java.lang.Object
   ↳ com.pdftron.pdf.utils.Vec2

Summary

Public Constructors
Vec2()
Empty constructor, initializes to 0
Vec2(double x, double y)
Creates an instance of the Vec2 class and initializes x and y
Public Methods
static Vec2 add(Vec2 vec1, Vec2 vec2)
void add(Vec2 vec)
Adds to this Vec2 the values of another
void addX(Vec2 vec)
void addY(Vec2 vec)
static Vec2 divide(Vec2 vec1, Vec2 vec2)
static Vec2 divide(Vec2 vec1, double val)
float dot(Vec2 vec)
Calculates the dot product of this Vec2 with another
boolean equals(Object obj)
Vec2 getIntValue()
Gets a Vec2 with the truncated values of the float coordinates
Vec2 getPerp()
Vec2 getVectorTo(Vec2 point)
Returns a vector from this to the point provided
Vec2 getVectorTo(int x, int y)
double length()
Calculates the vector length
static Vec2 multiply(Vec2 vec1, double val)
static Vec2 multiply(Vec2 vec1, Vec2 vec2)
Vec2 normalize()
Normalizes the vector
Vec2 normalized()
void offset(double x, double y)
Adds the offset to the current position
boolean roundEqual(Vec2 vec)
Checks if the rounded coordinates of both vectors are equal
void scale(float val)
Multiplies the x and y components by the value
void set(double x, double y)
Sets the x,y
void setX(double x)
Sets the x
void setY(double y)
Sets the y
static Vec2 subtract(Vec2 vec1, Vec2 vec2)
void subtract(Vec2 vec)
Subtracts to this Vec2 the values of another
void subtractX(Vec2 vec)
void subtractY(Vec2 vec)
PointF toPointF()
double x()
Gets the x value
double y()
Gets the y value
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Vec2 ()

Empty constructor, initializes to 0

public Vec2 (double x, double y)

Creates an instance of the Vec2 class and initializes x and y

Public Methods

public static Vec2 add (Vec2 vec1, Vec2 vec2)

public void add (Vec2 vec)

Adds to this Vec2 the values of another

Parameters
vec Vec2 to add

public void addX (Vec2 vec)

public void addY (Vec2 vec)

public static Vec2 divide (Vec2 vec1, Vec2 vec2)

public static Vec2 divide (Vec2 vec1, double val)

public float dot (Vec2 vec)

Calculates the dot product of this Vec2 with another

Parameters
vec Vec2 to do the product with
Returns
  • the dot product

public boolean equals (Object obj)

public Vec2 getIntValue ()

Gets a Vec2 with the truncated values of the float coordinates

Returns
  • A Vec2 with no decimals.

public Vec2 getPerp ()

public Vec2 getVectorTo (Vec2 point)

Returns a vector from this to the point provided

Parameters
point to calculate the vector to
Returns
  • The vector.

public Vec2 getVectorTo (int x, int y)

public double length ()

Calculates the vector length

Returns
  • the length of the vector

public static Vec2 multiply (Vec2 vec1, double val)

public static Vec2 multiply (Vec2 vec1, Vec2 vec2)

public Vec2 normalize ()

Normalizes the vector

public Vec2 normalized ()

public void offset (double x, double y)

Adds the offset to the current position

Parameters
x to add to the x component
y to add to the y component

public boolean roundEqual (Vec2 vec)

Checks if the rounded coordinates of both vectors are equal

Parameters
vec Vec2 to check against
Returns
  • True if they are equal, false if they are not.

public void scale (float val)

Multiplies the x and y components by the value

Parameters
val Multiplier for the components

public void set (double x, double y)

Sets the x,y

public void setX (double x)

Sets the x

public void setY (double y)

Sets the y

public static Vec2 subtract (Vec2 vec1, Vec2 vec2)

public void subtract (Vec2 vec)

Subtracts to this Vec2 the values of another

Parameters
vec Vec2 to subtract

public void subtractX (Vec2 vec)

public void subtractY (Vec2 vec)

public PointF toPointF ()

public double x ()

Gets the x value

Returns
  • x

public double y ()

Gets the y value

Returns
  • y