Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2023.
Loading...
Searching...
No Matches
SVector Class Reference

Allow the use of the mathematical vector object. More...

Public Member Functions

SVector Add (SVector vector)
 Calculate the sum of the current vector and another vector. More...
 
 ApplyTransformation (SMatrix matrix)
 Apply a geometric transformation to the current SVector by making a product with the given matrix. More...
 
SVector Div (number divValue)
 Calculate the division of a vector by a scalar. More...
 
boolean Equals (SVector vectToCompare)
 Test if two vectors are equal or not. More...
 
number GetLength ()
 Get the length of the SVector. More...
 
SVector GetNormalized ()
 Normalize a copy of the current vector. More...
 
number GetX ()
 Get the X coordinate value. More...
 
number GetY ()
 Get the Y coordinate value. More...
 
number GetZ ()
 Get the Z coordinate value. More...
 
boolean IsNull ()
 Return if the vector is null (0, 0, 0) or not. More...
 
SVector Mult (number multValue)
 Calculate the multiplication of a vector by a scalar. More...
 
 Normalize ()
 Modify the 3D vector to have its norm equal to 1. More...
 
 Opposite ()
 Modify the SVector to have its opposite. More...
 
 SetX (number x)
 Set the X coordinate. More...
 
 SetY (number y)
 Set the Y coordinate. More...
 
 SetZ (number z)
 Set the Z coordinate. More...
 
SVector Sub (SVector vector)
 Calculate the subtraction of the current vector and another vector. More...
 
 SVector ()
 Empty constructor. More...
 
 SVector (number x, number y, number z)
 Constructor from X, Y, Z coordinates. More...
 
 SVector (SPoint endPt)
 Constructor from one point. The result is the vector between the origin (0,0,0) and the point 'endPt'. More...
 
 SVector (SPoint startPt, SPoint endPt)
 Constructor which initializes the vector between a starting point and an ending point.In other words the vector is initialized to 'endPt'-'startPt'. More...
 
 SVector (SVector other)
 Constructor by copy from other vector. More...
 
string toString ()
 Get the type of the variable. More...
 
string ValuesToString ()
 Get a string representation of the vector. More...
 

Static Public Member Functions

static number Angle (SVector vector1, SVector vector2)
 Compute the angle in degrees between two 3D vectors. More...
 
static SVector Cross (SVector v1, SVector v2)
 Make the 3D vectorial product of two 3D vectors (cross product). More...
 
static number Dot (SVector v1, SVector v2)
 Make the scalar product of two 3D vectors (dot product). More...
 
static SVector New ()
 Empty constructor. More...
 
static SVector New (number x, number y, number z)
 Constructor from X, Y, Z coordinates. More...
 
static SVector New (SPoint endPt)
 Constructor from one point. The result is the vector between the origin (0,0,0) and the point 'endPt'. More...
 
static SVector New (SPoint startPt, SPoint endPt)
 Constructor which initializes the vector between a starting point and an ending point.In other words the vector is initialized to 'endPt'-'startPt'. More...
 
static SVector New (SVector other)
 Constructor by copy from other vector. More...
 

Detailed Description

Allow the use of the mathematical vector object.

Constructor & Destructor Documentation

◆ SVector() [1/5]

SVector::SVector ( )

Empty constructor.

◆ SVector() [2/5]

SVector::SVector ( SVector  other)

Constructor by copy from other vector.

Parameters
other(SVector) The SVector to copy

◆ SVector() [3/5]

SVector::SVector ( number  x,
number  y,
number  z 
)

Constructor from X, Y, Z coordinates.

Parameters
x(number) The X coordinate
y(number) The Y coordinate
z(number) The Z coordinate

◆ SVector() [4/5]

SVector::SVector ( SPoint  endPt)

Constructor from one point. The result is the vector between the origin (0,0,0) and the point 'endPt'.

Parameters
endPt(SPoint) The SPoint to construct the vector with.

◆ SVector() [5/5]

SVector::SVector ( SPoint  startPt,
SPoint  endPt 
)

Constructor which initializes the vector between a starting point and an ending point.In other words the vector is initialized to 'endPt'-'startPt'.

Parameters
startPt(SPoint) The starting SPoint.
endPt(SPoint) The ending SPoint.

Member Function Documentation

◆ Add()

SVector SVector::Add ( SVector  vector)

Calculate the sum of the current vector and another vector.

var myVector = SVector.New(7, 7, 7);
myVector = myVector.Add(SVector.New(3, 3, 3)); // myVector == (10, 10, 10) now
Allow the use of the mathematical vector object.
Definition: Reshaper.h:1994
static SVector New()
Empty constructor.
SVector Add(SVector vector)
Calculate the sum of the current vector and another vector.
Parameters
vector(SVector) The SVector used for the addition
Returns
(SVector) The new SVector which is the result of the addition.

◆ Angle()

static number SVector::Angle ( SVector  vector1,
SVector  vector2 
)
static

Compute the angle in degrees between two 3D vectors.

Warning
Throw an exception if 'vector1' or 'vector2' is null
Parameters
vector1(SVector) The first vector to compute angle with.
vector2(SVector) The second vector to compute angle with.
Returns
(number) The angle between the 2 vectors (in degrees).

◆ ApplyTransformation()

SVector::ApplyTransformation ( SMatrix  matrix)

Apply a geometric transformation to the current SVector by making a product with the given matrix.

Parameters
matrix(SMatrix) The SMatrix to apply on the vector

◆ Cross()

static SVector SVector::Cross ( SVector  v1,
SVector  v2 
)
static

Make the 3D vectorial product of two 3D vectors (cross product).

Parameters
v1(SVector) The first vector
v2(SVector) The second vector
Returns
(SVector) The vector v1 ^ v2 is returned.

◆ Div()

SVector SVector::Div ( number  divValue)

Calculate the division of a vector by a scalar.

var myVector = SVector.New(4, 4, 4);
myVector = myVector.Div(2); // myVector == (2, 2, 2) now
SVector Div(number divValue)
Calculate the division of a vector by a scalar.
Parameters
divValue(number) The value used for the division
Returns
(SVector) The new SVector which is the division of current SVector with 'divValue'

◆ Dot()

static number SVector::Dot ( SVector  v1,
SVector  v2 
)
static

Make the scalar product of two 3D vectors (dot product).

Parameters
v1(SVector) The first vector
v2(SVector) The second vector
Returns
(number) The scalar product v1 * v2

◆ Equals()

boolean SVector::Equals ( SVector  vectToCompare)

Test if two vectors are equal or not.

Parameters
vectToCompare(SVector) The SVector to compare with.
Returns
(boolean) True if the points are equal.(nearly to epsilon)

◆ GetLength()

number SVector::GetLength ( )

Get the length of the SVector.

Returns
(number) The length of the vector

◆ GetNormalized()

SVector SVector::GetNormalized ( )

Normalize a copy of the current vector.

See also
Normalize
Returns
(SVector) The normalized SVector.

◆ GetX()

number SVector::GetX ( )

Get the X coordinate value.

Returns
(number) The X coordinate.

◆ GetY()

number SVector::GetY ( )

Get the Y coordinate value.

Returns
(number) The Y coordinate.

◆ GetZ()

number SVector::GetZ ( )

Get the Z coordinate value.

Returns
(number) The Z coordinate.

◆ IsNull()

boolean SVector::IsNull ( )

Return if the vector is null (0, 0, 0) or not.

Returns
(boolean) True is the SVector is null

◆ Mult()

SVector SVector::Mult ( number  multValue)

Calculate the multiplication of a vector by a scalar.

var myVector = SVector.New(1, 1, 1);
myVector = myVector.Mult(7); // myVector == (7, 7, 7) now
SVector Mult(number multValue)
Calculate the multiplication of a vector by a scalar.
Parameters
multValue(number) The value used for the multiplication
Returns
(SVector) The new SVector which is the current SVector multiplied by 'multValue'

◆ New() [1/5]

static SVector SVector::New ( )
static

Empty constructor.

Returns
(SVector) The new SVector.

◆ New() [2/5]

static SVector SVector::New ( number  x,
number  y,
number  z 
)
static

Constructor from X, Y, Z coordinates.

Parameters
x(number) The X coordinate
y(number) The Y coordinate
z(number) The Z coordinate
Returns
(SVector) The new SVector.

◆ New() [3/5]

static SVector SVector::New ( SPoint  endPt)
static

Constructor from one point. The result is the vector between the origin (0,0,0) and the point 'endPt'.

Parameters
endPt(SPoint) The SPoint to construct the vector with.
Returns
(SVector) The new SVector.

◆ New() [4/5]

static SVector SVector::New ( SPoint  startPt,
SPoint  endPt 
)
static

Constructor which initializes the vector between a starting point and an ending point.In other words the vector is initialized to 'endPt'-'startPt'.

Parameters
startPt(SPoint) The starting SPoint.
endPt(SPoint) The ending SPoint.
Returns
(SVector) The new SVector.

◆ New() [5/5]

static SVector SVector::New ( SVector  other)
static

Constructor by copy from other vector.

Parameters
other(SVector) The SVector to copy
Returns
(SVector) The new SVector.

◆ Normalize()

SVector::Normalize ( )

Modify the 3D vector to have its norm equal to 1.

See also
GetNormalized

◆ Opposite()

SVector::Opposite ( )

Modify the SVector to have its opposite.

◆ SetX()

SVector::SetX ( number  x)

Set the X coordinate.

Parameters
x(number) The value to set.

◆ SetY()

SVector::SetY ( number  y)

Set the Y coordinate.

Parameters
y(number) The value to set.

◆ SetZ()

SVector::SetZ ( number  z)

Set the Z coordinate.

Parameters
z(number) The value to set.

◆ Sub()

SVector SVector::Sub ( SVector  vector)

Calculate the subtraction of the current vector and another vector.

var myVector = SVector.New(7, 7, 7);
myVector = myVector.Sub(SVector.New(2, 2, 2)); // myVector == (5, 5, 5) now
SVector Sub(SVector vector)
Calculate the subtraction of the current vector and another vector.
Parameters
vector(SVector) The SVector used for the subtraction
Returns
(SVector) The SVector which is the result of the subtraction

◆ toString()

string SVector::toString ( )

Get the type of the variable.

Returns
(string) The type name

◆ ValuesToString()

string SVector::ValuesToString ( )

Get a string representation of the vector.

Returns
(string) A string representing the vector.