unreal.MathLibrary
¶
-
class
unreal.
MathLibrary
(outer=None, name='None')¶ Bases:
unreal.BlueprintFunctionLibrary
Kismet Math Library
C++ Source:
Module: Engine
File: KismetMathLibrary.h
-
classmethod
abs_int
(a) → int32¶ Returns the absolute (positive) value of A
- Parameters
a (int32) –
- Returns
- Return type
int32
-
classmethod
abs_int64
(a) → int64¶ Returns the absolute (positive) value of A
- Parameters
a (int64) –
- Returns
- Return type
int64
-
classmethod
add_byte_byte
(a, b=1) → uint8¶ Addition (A + B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
uint8
-
classmethod
add_int64_int64
(a, b=1) → int64¶ Addition (A + B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
int64
-
classmethod
add_int_int
(a, b=1) → int32¶ Addition (A + B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
int32
-
classmethod
add_linear_color_linear_color
(a, b) → LinearColor¶ Element-wise addition of two linear colors (R+R, G+G, B+B, A+A)
- Parameters
a (LinearColor) –
b (LinearColor) –
- Returns
- Return type
-
classmethod
add_vector2d_vector2d
(a, b) → Vector2D¶ Returns addition of Vector A and Vector B (A + B)
-
classmethod
and_int64_int64
(a, b) → int64¶ Bitwise AND (A & B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
int64
-
classmethod
and_int_int
(a, b) → int32¶ Bitwise AND (A & B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
int32
-
classmethod
b_max
(a, b) → uint8¶ Returns the maximum value of A and B
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
uint8
-
classmethod
b_min
(a, b) → uint8¶ Returns the minimum value of A and B
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
uint8
-
classmethod
break_color
(color) -> (r=float, g=float, b=float, a=float)¶ Breaks apart a color into individual RGB components (as well as alpha)
- Parameters
color (LinearColor) –
- Returns
r (float):
g (float):
b (float):
a (float):
- Return type
tuple
-
classmethod
break_rot_into_axes
(rot) -> (x=Vector, y=Vector, z=Vector)¶ Breaks apart a rotator into its component axes
- Parameters
rot (Rotator) –
- Returns
x (Vector):
y (Vector):
z (Vector):
- Return type
tuple
-
classmethod
c_interp_to
(current, target, delta_time, interp_speed) → LinearColor¶ Interpolate Linear Color from Current to Target. Scaled by distance to Target, so it has a strong start speed and ease out.
- Parameters
current (LinearColor) – Current Color
target (LinearColor) – Target Color
delta_time (float) – Time since last tick
interp_speed (float) – Interpolation speed, if the speed given is 0, then jump to the target.
- Returns
New interpolated Color
- Return type
-
classmethod
clamp
(value, min, max) → int32¶ Returns Value clamped to be between A and B (inclusive)
- Parameters
value (int32) –
min (int32) –
max (int32) –
- Returns
- Return type
int32
-
classmethod
clamp_angle
(angle_degrees, min_angle_degrees, max_angle_degrees) → float¶ Clamps an arbitrary angle to be between the given angles. Will clamp to nearest boundary.
- Parameters
- Returns
Returns clamped angle in the range -180..180.
- Return type
-
classmethod
clamp_axes2d
(a, min_axis_val, max_axis_val) → Vector2D¶ Creates a copy of this vector with both axes clamped to the given range.
-
classmethod
clamp_int64
(value, min, max) → int64¶ Returns Value clamped to be between A and B (inclusive)
- Parameters
value (int64) –
min (int64) –
max (int64) –
- Returns
- Return type
int64
-
classmethod
clamp_vector_size
(a, min, max) → Vector¶ Create a copy of this vector, with its magnitude/size/length clamped between Min and Max.
-
classmethod
class_is_child_of
(test_class, parent_class) → bool¶ Determine if a class is a child of another class.
-
classmethod
compose_rotators
(a, b) → Rotator¶ Combine 2 rotations to give you the resulting rotation of first applying A, then B.
-
classmethod
compose_transforms
(a, b) → Transform¶ Compose two transforms in order: A * B.
Order matters when composing transforms: A * B will yield a transform that logically first applies A then B to any subsequent transformation.
Example: LocalToWorld = ComposeTransforms(DeltaRotation, LocalToWorld) will change rotation in local space by DeltaRotation. Example: LocalToWorld = ComposeTransforms(LocalToWorld, DeltaRotation) will change rotation in world space by DeltaRotation.
-
classmethod
conv_bool_to_byte
(bool) → uint8¶ Converts a bool to a byte
- Parameters
bool (bool) –
- Returns
- Return type
uint8
-
classmethod
conv_bool_to_int
(bool) → int32¶ Converts a bool to an int
- Parameters
bool (bool) –
- Returns
- Return type
int32
-
classmethod
conv_byte_to_float
(byte) → float¶ Converts a byte to a float
- Parameters
byte (uint8) –
- Returns
- Return type
-
classmethod
conv_byte_to_int
(byte) → int32¶ Converts a byte to an integer
- Parameters
byte (uint8) –
- Returns
- Return type
int32
-
classmethod
conv_color_to_linear_color
(color) → LinearColor¶ Converts a color to LinearColor
- Parameters
color (Color) –
- Returns
- Return type
-
classmethod
conv_float_to_linear_color
(float) → LinearColor¶ Convert a float into a LinearColor, where each element is that float
- Parameters
float (float) –
- Returns
- Return type
-
classmethod
conv_float_to_vector
(float) → Vector¶ Convert a float into a vector, where each element is that float
-
classmethod
conv_int64_to_byte
(int) → uint8¶ Converts a 64 bit integer to a byte (if the integer is too large, returns the low 8 bits)
- Parameters
int (int64) –
- Returns
- Return type
uint8
-
classmethod
conv_int64_to_int
(int) → int32¶ Converts a 64 bit integer to a 32 bit integer (if the integer is too large, returns the low 32 bits)
- Parameters
int (int64) –
- Returns
- Return type
int32
-
classmethod
conv_int_to_bool
(int) → bool¶ Converts a int to a bool
- Parameters
int (int32) –
- Returns
- Return type
-
classmethod
conv_int_to_byte
(int) → uint8¶ Converts an integer to a byte (if the integer is too large, returns the low 8 bits)
- Parameters
int (int32) –
- Returns
- Return type
uint8
-
classmethod
conv_int_to_float
(int) → float¶ Converts an integer to a float
- Parameters
int (int32) –
- Returns
- Return type
-
classmethod
conv_int_to_int64
(int) → int64¶ Converts an integer to a 64 bit integer
- Parameters
int (int32) –
- Returns
- Return type
int64
-
classmethod
conv_int_to_int_vector
(int) → IntVector¶ Converts an integer to an IntVector
- Parameters
int (int32) –
- Returns
- Return type
-
classmethod
conv_linear_color_to_color
(linear_color, use_srgb=True) → Color¶ Quantizes the linear color and returns the result as a FColor with optional sRGB conversion and quality as goal.
- Parameters
linear_color (LinearColor) –
use_srgb (bool) –
- Returns
- Return type
-
classmethod
conv_linear_color_to_vector
(linear_color) → Vector¶ Converts a LinearColor to a vector
- Parameters
linear_color (LinearColor) –
- Returns
- Return type
-
classmethod
conv_matrix_to_rotator
(matrix) → Rotator¶ Convert a Matrix to a Rotator (Assumes Matrix represents a transform)
-
classmethod
conv_matrix_to_transform
(matrix) → Transform¶ Convert a Matrix to a Transform (Assumes Matrix represents a transform)
-
classmethod
conv_transform_to_matrix
(transform) → Matrix¶ Convert a Transform to a Matrix with scale
-
classmethod
conv_vector4_to_quaterion
(vec)¶ deprecated: ‘conv_vector4_to_quaterion’ was renamed to ‘conv_vector4_to_quaternion’.
-
classmethod
conv_vector4_to_quaternion
(vec) → Quat¶ Return the Quaternion orientation corresponding to the direction in which the vector points. Similar to the FRotator version, returns a result without roll such that it preserves the up vector. If you don’t care about preserving the up vector and just want the most direct rotation, you can use the faster ‘FQuat::FindBetweenVectors(FVector::ForwardVector, YourVector)’ or ‘FQuat::FindBetweenNormals(…)’ if you know the vector is of unit length.:
-
classmethod
conv_vector4_to_rotator
(vec) → Rotator¶ Return the FRotator orientation corresponding to the direction in which the vector points. Sets Yaw and Pitch to the proper numbers, and sets Roll to zero because the roll can’t be determined from a vector.
-
classmethod
conv_vector4_to_vector
(vector4) → Vector¶ Convert a Vector4 to a Vector (dropping the W element)
-
classmethod
conv_vector_to_linear_color
(vec) → LinearColor¶ Converts a vector to LinearColor
- Parameters
vec (Vector) –
- Returns
- Return type
-
classmethod
conv_vector_to_quaterion
(vec)¶ deprecated: ‘conv_vector_to_quaterion’ was renamed to ‘conv_vector_to_quaternion’.
-
classmethod
conv_vector_to_quaternion
(vec) → Quat¶ Return the Quaternion orientation corresponding to the direction in which the vector points. Similar to the FRotator version, returns a result without roll such that it preserves the up vector. If you don’t care about preserving the up vector and just want the most direct rotation, you can use the faster ‘FQuat::FindBetweenVectors(FVector::ForwardVector, YourVector)’ or ‘FQuat::FindBetweenNormals(…)’ if you know the vector is of unit length.:
-
classmethod
conv_vector_to_rotator
(vec) → Rotator¶ Return the FRotator orientation corresponding to the direction in which the vector points. Sets Yaw and Pitch to the proper numbers, and sets Roll to zero because the roll can’t be determined from a vector.
-
classmethod
conv_vector_to_transform
(location) → Transform¶ Convert a vector to a transform. Uses vector as location
-
classmethod
conv_vector_to_vector2d
(vector) → Vector2D¶ Convert a Vector to a Vector2D using the Vector’s (X, Y) coordinates
-
classmethod
convert_transform_to_relative
(transform, parent_transform) → Transform¶ Convert Transform to Relative
-
classmethod
create_vector_from_yaw_pitch
(yaw, pitch, length=1.0) → Vector¶ Creates a directional vector from rotation values {Pitch, Yaw} supplied in degrees with specified Length
-
classmethod
cross_product2d
(a, b) → float¶ Returns the cross product of two 2d vectors - see http://mathworld.wolfram.com/CrossProduct.html
-
classmethod
cross_vector_vector
(a, b) → Vector¶ Returns the cross product of two 3d vectors - see http://mathworld.wolfram.com/CrossProduct.html
-
classmethod
date_time_from_iso_string
(iso_string) → DateTime or None¶ Converts a date string in ISO-8601 format to a DateTime object
-
classmethod
date_time_from_string
(date_time_string) → DateTime or None¶ Converts a date string to a DateTime object
-
classmethod
date_time_max_value
() → DateTime¶ Returns the maximum date and time value
- Returns
- Return type
-
classmethod
date_time_min_value
() → DateTime¶ Returns the minimum date and time value
- Returns
- Return type
-
classmethod
days_in_month
(year, month) → int32¶ Returns the number of days in the given year and month
- Parameters
year (int32) –
month (int32) –
- Returns
- Return type
int32
-
classmethod
days_in_year
(year) → int32¶ Returns the number of days in the given year
- Parameters
year (int32) –
- Returns
- Return type
int32
-
classmethod
divide_byte_byte
(a, b=1) → uint8¶ Division (A / B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
uint8
-
classmethod
divide_int64_int64
(a, b=1) → int64¶ Division (A / B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
int64
-
classmethod
divide_int_int
(a, b=1) → int32¶ Division (A / B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
int32
-
classmethod
divide_linear_color_linear_color
(a, b) → LinearColor¶ Element-wise multiplication of two linear colors (R/R, G/G, B/B, A/A)
- Parameters
a (LinearColor) –
b (LinearColor) –
- Returns
- Return type
-
classmethod
divide_vector2d_vector2d
(a, b) → Vector2D¶ Element-wise Vector divide (Result = {A.x/B.x, A.y/B.y})
-
classmethod
divide_vector4_vector4
(a, b) → Vector4¶ Element-wise Vector divide (Result = {A.x/B.x, A.y/B.y, A.z/B.z, A.w/B.w})
-
classmethod
divide_vector_vector
(a, b=[1.0, 1.0, 1.0]) → Vector¶ Element-wise Vector division (Result = {A.x/B.x, A.y/B.y, A.z/B.z})
-
classmethod
dot_product2d
(a, b) → float¶ Returns the dot product of two 2d vectors - see http://mathworld.wolfram.com/DotProduct.html
-
classmethod
dot_vector_vector
(a, b) → float¶ Returns the dot product of two 3d vectors - see http://mathworld.wolfram.com/DotProduct.html
-
classmethod
dynamic_weighted_moving_average_f_rotator
(current_sample, previous_sample, max_distance, min_weight, max_weight) → Rotator¶ Calculates the new value in a weighted moving average series using the previous value and a weight range. The weight range is used to dynamically adjust based upon distance between the samples This allows you to smooth a value more aggressively for small noise and let large movements be smoothed less (or vice versa)
- Parameters
current_sample (Rotator) – The value to blend with the previous sample to get a new weighted value
previous_sample (Rotator) – The last value from the series
max_distance (float) – Distance to use as the blend between min weight or max weight
min_weight (float) – The weight use when the distance is small
max_weight (float) – The weight use when the distance is large
- Returns
the next value in the series
- Return type
-
classmethod
dynamic_weighted_moving_average_f_vector
(current_sample, previous_sample, max_distance, min_weight, max_weight) → Vector¶ Calculates the new value in a weighted moving average series using the previous value and a weight range. The weight range is used to dynamically adjust based upon distance between the samples This allows you to smooth a value more aggressively for small noise and let large movements be smoothed less (or vice versa)
- Parameters
current_sample (Vector) – The value to blend with the previous sample to get a new weighted value
previous_sample (Vector) – The last value from the series
max_distance (float) – Distance to use as the blend between min weight or max weight
min_weight (float) – The weight use when the distance is small
max_weight (float) – The weight use when the distance is large
- Returns
the next value in the series
- Return type
-
classmethod
dynamic_weighted_moving_average_float
(current_sample, previous_sample, max_distance, min_weight, max_weight) → float¶ Calculates the new value in a weighted moving average series using the previous value and a weight range. The weight range is used to dynamically adjust based upon distance between the samples This allows you to smooth a value more aggressively for small noise and let large movements be smoothed less (or vice versa)
- Parameters
current_sample (float) – The value to blend with the previous sample to get a new weighted value
previous_sample (float) – The last value from the series
max_distance (float) – Distance to use as the blend between min weight or max weight
min_weight (float) – The weight use when the distance is small
max_weight (float) – The weight use when the distance is large
- Returns
the next value in the series
- Return type
-
classmethod
equal_equal_byte_byte
(a, b) → bool¶ Returns true if A is equal to B (A == B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
-
classmethod
equal_equal_date_time_date_time
(a, b) → bool¶ Returns true if the values are equal (A == B)
-
classmethod
equal_equal_int64_int64
(a, b) → bool¶ Returns true if A is equal to B (A == B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
-
classmethod
equal_equal_int_int
(a, b) → bool¶ Returns true if A is equal to B (A == B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
-
classmethod
equal_equal_linear_color_linear_color
(a, b) → bool¶ Returns true if linear color A is equal to linear color B (A == B) within a specified error tolerance
- Parameters
a (LinearColor) –
b (LinearColor) –
- Returns
- Return type
-
classmethod
equal_equal_matrix_matrix
(a, b, tolerance=0.0001) → bool¶ Checks whether another Matrix is equal to this, within specified tolerance.
-
classmethod
equal_equal_quat_quat
(a, b, tolerance=0.0001) → bool¶ Returns true if Quaternion A is equal to Quaternion B (A == B) within a specified error tolerance
-
classmethod
equal_equal_rotator_rotator
(a, b, error_tolerance=0.0001) → bool¶ Returns true if rotator A is equal to rotator B (A == B) within a specified error tolerance
-
classmethod
equal_equal_timespan_timespan
(a, b) → bool¶ Returns true if the values are equal (A == B)
-
classmethod
equal_equal_transform_transform
(a, b) → bool¶ Returns true if transform A is equal to transform B
-
classmethod
equal_equal_vector2d_vector2d
(a, b, error_tolerance=0.0001) → bool¶ Returns true if vector2D A is equal to vector2D B (A == B) within a specified error tolerance
-
classmethod
equal_equal_vector4_vector4
(a, b, error_tolerance=0.0001) → bool¶ Returns true if vector A is equal to vector B (A == B) within a specified error tolerance
-
classmethod
equal_equal_vector_vector
(a, b, error_tolerance=0.0001) → bool¶ Returns true if vector A is equal to vector B (A == B) within a specified error tolerance
-
classmethod
equal_exactly_vector2d_vector2d
(a, b) → bool¶ Returns true if vector A is equal to vector B (A == B)
-
classmethod
equal_exactly_vector4_vector4
(a, b) → bool¶ Returns true if vector A is equal to vector B (A == B)
-
classmethod
equal_exactly_vector_vector
(a, b) → bool¶ Returns true if vector A is equal to vector B (A == B)
-
classmethod
equal_int_point_int_point
(a, b) → bool¶ Returns true if IntPoint A is equal to IntPoint B (A == B)
-
classmethod
f_ceil
(a) → int32¶ Rounds A up towards positive infinity / up to the next integer (e.g., -1.6 becomes -1 and 1.6 becomes 2)
- Parameters
a (float) –
- Returns
- Return type
int32
-
classmethod
f_ceil64
(a) → int64¶ Rounds A up towards positive infinity / up to the next integer (e.g., -1.6 becomes -1 and 1.6 becomes 2)
- Parameters
a (float) –
- Returns
- Return type
int64
-
classmethod
f_floor
(a) → int32¶ Rounds A down towards negative infinity / down to the previous integer (e.g., -1.6 becomes -2 and 1.6 becomes 1)
- Parameters
a (float) –
- Returns
- Return type
int32
-
classmethod
f_floor64
(a) → int64¶ Rounds A down towards negative infinity / down to the previous integer (e.g., -1.6 becomes -2 and 1.6 becomes 1)
- Parameters
a (float) –
- Returns
- Return type
int64
-
classmethod
f_interp_ease_in_out
(a, b, alpha, exponent) → float¶ Interpolate between A and B, applying an ease in/out function. Exp controls the degree of the curve.
-
classmethod
f_interp_to
(current, target, delta_time, interp_speed) → float¶ Tries to reach Target based on distance from Current position, giving a nice smooth feeling when tracking a position.
-
classmethod
f_interp_to_constant
(current, target, delta_time, interp_speed) → float¶ Tries to reach Target at a constant rate.
-
classmethod
f_mod
(dividend, divisor) -> (int32, remainder=float)¶ Returns the number of times Divisor will go into Dividend (i.e., Dividend divided by Divisor), as well as the remainder
-
classmethod
f_rand
()¶ deprecated: ‘f_rand’ was renamed to ‘random_float’.
-
classmethod
f_rand_from_stream
(stream)¶ deprecated: ‘f_rand_from_stream’ was renamed to ‘random_float_from_stream’.
-
classmethod
f_rand_range
(min, max)¶ deprecated: ‘f_rand_range’ was renamed to ‘random_float_in_range’.
-
classmethod
f_rand_range_from_stream
(min, max, stream)¶ deprecated: ‘f_rand_range_from_stream’ was renamed to ‘random_float_in_range_from_stream’.
-
classmethod
f_trunc
(a) → int32¶ Rounds A towards zero, truncating the fractional part (e.g., -1.6 becomes -1 and 1.6 becomes 1)
- Parameters
a (float) –
- Returns
- Return type
int32
-
classmethod
f_trunc64
(a) → int64¶ Rounds A towards zero, truncating the fractional part (e.g., -1.6 becomes -1 and 1.6 becomes 1)
- Parameters
a (float) –
- Returns
- Return type
int64
-
classmethod
f_trunc_vector
(vector) → IntVector¶ Rounds A to an integer with truncation towards zero for each element in a vector. (e.g. -1.7 truncated to -1, 2.8 truncated to 2)
-
classmethod
find_closest_point_on_line
(point, line_origin, line_direction) → Vector¶ Find the closest point on an infinite line to a given point.
-
classmethod
find_closest_point_on_segment
(point, segment_start, segment_end) → Vector¶ Find the closest point on a segment to a given point.
-
classmethod
find_look_at_rotation
(start, target) → Rotator¶ Find a rotation for an object at Start location to point at Target location.
-
classmethod
find_nearest_points_on_line_segments
(segment1_start, segment1_end, segment2_start, segment2_end) -> (segment1_point=Vector, segment2_point=Vector)¶ Find closest points between 2 segments.
- Parameters
- Returns
segment1_point (Vector): Closest point on segment 1 to segment 2.
segment2_point (Vector): Closest point on segment 2 to segment 1.
- Return type
tuple
-
classmethod
fixed_turn
(current, desired, delta_rate) → float¶ Returns a new rotation component value
-
classmethod
float_spring_interp
(current, target, spring_state, stiffness, critical_damping_factor, delta_time, mass=1.000000) -> (float, spring_state=FloatSpringState)¶ Uses a simple spring model to interpolate a float from Current to Target.
- Parameters
current (float) – Current value
target (float) – Target value
spring_state (FloatSpringState) – Data related to spring model (velocity, error, etc..) - Create a unique variable per spring
stiffness (float) – How stiff the spring model is (more stiffness means more oscillation around the target value)
critical_damping_factor (float) – How much damping to apply to the spring (0 means no damping, 1 means critically damped which means no oscillation)
delta_time (float) –
mass (float) – Multiplier that acts like mass on a spring
- Returns
spring_state (FloatSpringState):
- Return type
-
classmethod
from_days
(days) → Timespan¶ Returns a time span that represents the specified number of days
-
classmethod
from_hours
(hours) → Timespan¶ Returns a time span that represents the specified number of hours
-
classmethod
from_milliseconds
(milliseconds) → Timespan¶ Returns a time span that represents the specified number of milliseconds
-
classmethod
from_minutes
(minutes) → Timespan¶ Returns a time span that represents the specified number of minutes
-
classmethod
from_seconds
(seconds) → Timespan¶ Returns a time span that represents the specified number of seconds
-
classmethod
get_abs2d
(a) → Vector2D¶ Get a copy of this vector with absolute value of each component.
-
classmethod
get_axes
(a) -> (x=Vector, y=Vector, z=Vector)¶ Get the reference frame direction vectors (axes) described by this rotation
- Parameters
a (Rotator) –
- Returns
x (Vector):
y (Vector):
z (Vector):
- Return type
tuple
-
classmethod
get_day
(a) → int32¶ Returns the day component of A (1 to 31)
- Parameters
a (DateTime) –
- Returns
- Return type
int32
-
classmethod
get_day_of_year
(a) → int32¶ Returns the day of year of A
- Parameters
a (DateTime) –
- Returns
- Return type
int32
-
classmethod
get_days
(a) → int32¶ Returns the days component of A
- Parameters
a (Timespan) –
- Returns
- Return type
int32
-
classmethod
get_direction_unit_vector
(from_, to) → Vector¶ Find the unit direction vector from one position to another or (0,0,0) if positions are the same.
-
classmethod
get_direction_vector
(from_, to)¶ deprecated: ‘get_direction_vector’ was renamed to ‘get_direction_unit_vector’.
-
classmethod
get_hour
(a) → int32¶ Returns the hour component of A (24h format)
- Parameters
a (DateTime) –
- Returns
- Return type
int32
-
classmethod
get_hour12
(a) → int32¶ Returns the hour component of A (12h format)
- Parameters
a (DateTime) –
- Returns
- Return type
int32
-
classmethod
get_hours
(a) → int32¶ Returns the hours component of A
- Parameters
a (Timespan) –
- Returns
- Return type
int32
-
classmethod
get_millisecond
(a) → int32¶ Returns the millisecond component of A
- Parameters
a (DateTime) –
- Returns
- Return type
int32
-
classmethod
get_milliseconds
(a) → int32¶ Returns the milliseconds component of A
- Parameters
a (Timespan) –
- Returns
- Return type
int32
-
classmethod
get_minute
(a) → int32¶ Returns the minute component of A
- Parameters
a (DateTime) –
- Returns
- Return type
int32
-
classmethod
get_minutes
(a) → int32¶ Returns the minutes component of A
- Parameters
a (Timespan) –
- Returns
- Return type
int32
-
classmethod
get_month
(a) → int32¶ Returns the month component of A
- Parameters
a (DateTime) –
- Returns
- Return type
int32
-
classmethod
get_point_distance_to_line
(point, line_origin, line_direction) → float¶ Find the distance from a point to the closest point on an infinite line.
- Parameters
- Returns
The distance from the given point to the closest point on the line.
- Return type
-
classmethod
get_point_distance_to_segment
(point, segment_start, segment_end) → float¶ Find the distance from a point to the closest point on a segment.
-
classmethod
get_reflection_vector
(direction, surface_normal) → Vector¶ Given a direction vector and a surface normal, returns the vector reflected across the surface normal. Produces a result like shining a laser at a mirror!
-
classmethod
get_second
(a) → int32¶ Returns the second component of A
- Parameters
a (DateTime) –
- Returns
- Return type
int32
-
classmethod
get_seconds
(a) → int32¶ Returns the seconds component of A
- Parameters
a (Timespan) –
- Returns
- Return type
int32
-
classmethod
get_slope_degree_angles
(my_right_y_axis, floor_normal, up_vector) -> (out_slope_pitch_degree_angle=float, out_slope_roll_degree_angle=float)¶ Returns Slope Pitch and Roll angles in degrees based on the following information: OutSlopePitchDegreeAngle Slope Pitch angle (degrees): OutSlopeRollDegreeAngle Slope Roll angle (degrees):
- Parameters
- Returns
out_slope_pitch_degree_angle (float):
out_slope_roll_degree_angle (float):
- Return type
tuple
-
classmethod
get_year
(a) → int32¶ Returns the year component of A
- Parameters
a (DateTime) –
- Returns
- Return type
int32
-
classmethod
greater_byte_byte
(a, b) → bool¶ Returns true if A is greater than B (A > B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
-
classmethod
greater_equal_byte_byte
(a, b) → bool¶ Returns true if A is greater than or equal to B (A >= B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
-
classmethod
greater_equal_date_time_date_time
(a, b) → bool¶ Returns true if A is greater than or equal to B (A >= B)
-
classmethod
greater_equal_float_float
(a, b) → bool¶ Returns true if A is greater than or equal to B (A >= B)
-
classmethod
greater_equal_int64_int64
(a, b) → bool¶ Returns true if A is greater than or equal to B (A >= B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
-
classmethod
greater_equal_int_int
(a, b) → bool¶ Returns true if A is greater than or equal to B (A >= B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
-
classmethod
greater_equal_timespan_timespan
(a, b) → bool¶ Returns true if A is greater than or equal to B (A >= B)
-
classmethod
greater_greater_vector_rotator
(a, b) → Vector¶ Returns result of vector A rotated by Rotator B
-
classmethod
greater_int64_int64
(a, b) → bool¶ Returns true if A is greater than B (A > B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
-
classmethod
greater_int_int
(a, b) → bool¶ Returns true if A is greater than B (A > B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
-
classmethod
grid_snap_float
(location, grid_size) → float¶ - Snaps a value to the nearest grid multiple. E.g.,
Location = 5.1, GridSize = 10.0 : return value = 10.0
If GridSize is 0 Location is returned if GridSize is very small precision issues may occur.
-
classmethod
hsv_to_rgb
(h, s, v, a=1.0) → LinearColor¶ Make a color from individual color components (HSV space; Hue is [0..360) while Saturation and Value are 0..1)
- Parameters
- Returns
- Return type
-
classmethod
hsv_to_rgb_linear
(hsv) → LinearColor¶ Converts a HSV linear color (where H is in R, S is in G, and V is in B) to linear RGB
- Parameters
hsv (LinearColor) –
- Returns
- Return type
-
classmethod
hsv_to_rgb_vector
(hsv) → LinearColor¶ Converts a HSV linear color (where H is in R (0..360), S is in G (0..1), and V is in B (0..1)) to RGB
- Parameters
hsv (LinearColor) –
- Returns
rgb (LinearColor):
- Return type
-
classmethod
hypotenuse
(width, height) → float¶ Returns the hypotenuse of a right-angled triangle given the width and height.
-
classmethod
in_range_float_float
(value, min, max, inclusive_min=True, inclusive_max=True) → bool¶ Returns true if value is between Min and Max (V >= Min && V <= Max) If InclusiveMin is true, value needs to be equal or larger than Min, else it needs to be larger If InclusiveMax is true, value needs to be smaller or equal than Max, else it needs to be smaller
-
classmethod
in_range_int64_int64
(value, min, max, inclusive_min=True, inclusive_max=True) → bool¶ Returns true if value is between Min and Max (V >= Min && V <= Max) If InclusiveMin is true, value needs to be equal or larger than Min, else it needs to be larger If InclusiveMax is true, value needs to be smaller or equal than Max, else it needs to be smaller
-
classmethod
in_range_int_int
(value, min, max, inclusive_min=True, inclusive_max=True) → bool¶ Returns true if value is between Min and Max (V >= Min && V <= Max) If InclusiveMin is true, value needs to be equal or larger than Min, else it needs to be larger If InclusiveMax is true, value needs to be smaller or equal than Max, else it needs to be smaller
-
classmethod
inverse_lerp
(value, range_min, range_max)¶ deprecated: ‘inverse_lerp’ was renamed to ‘normalize_to_range’.
-
classmethod
inverse_transform_direction
(t, direction) → Vector¶ Transform a direction vector by the inverse of the supplied transform - will not change its length. For example, if T was an object’s transform, this would transform a direction from world space to local space.
-
classmethod
inverse_transform_location
(t, location) → Vector¶ Transform a position by the inverse of the supplied transform. For example, if T was an object’s transform, this would transform a position from world space to local space.
-
classmethod
inverse_transform_position
(t, location)¶ deprecated: ‘inverse_transform_position’ was renamed to ‘inverse_transform_location’.
-
classmethod
inverse_transform_rotation
(t, rotation) → Rotator¶ Transform a rotator by the inverse of the supplied transform. For example, if T was an object’s transform, this would transform a rotation from world space to local space.
-
classmethod
invert_transform
(t) → Transform¶ Returns the inverse of the given transform T.
Example: Given a LocalToWorld transform, WorldToLocal will be returned.
-
classmethod
is_leap_year
(year) → bool¶ Returns whether given year is a leap year
- Parameters
year (int32) –
- Returns
- Return type
-
classmethod
is_nearly_zero2d
(a, tolerance=0.0001) → bool¶ Checks whether vector is near to zero within a specified tolerance.
-
classmethod
is_point_in_box
(point, box_origin, box_extent) → bool¶ Determines whether the given point is in a box. Includes points on the box.
-
classmethod
is_point_in_box_with_transform
(point, box_world_transform, box_extent) → bool¶ Determines whether a given point is in a box with a given transform. Includes points on the box.
-
classmethod
lerp
(a, b, alpha) → float¶ Linearly interpolates between A and B based on Alpha (100% of A when Alpha=0 and 100% of B when Alpha=1)
-
classmethod
less_byte_byte
(a, b) → bool¶ Returns true if A is less than B (A < B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
-
classmethod
less_equal_byte_byte
(a, b) → bool¶ Returns true if A is less than or equal to B (A <= B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
-
classmethod
less_equal_date_time_date_time
(a, b) → bool¶ Returns true if A is less than or equal to B (A <= B)
-
classmethod
less_equal_float_float
(a, b) → bool¶ Returns true if A is Less than or equal to B (A <= B)
-
classmethod
less_equal_int64_int64
(a, b) → bool¶ Returns true if A is less than or equal to B (A <= B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
-
classmethod
less_equal_int_int
(a, b) → bool¶ Returns true if A is less than or equal to B (A <= B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
-
classmethod
less_equal_timespan_timespan
(a, b) → bool¶ Returns true if A is less than or equal to B (A <= B)
-
classmethod
less_int64_int64
(a, b) → bool¶ Returns true if A is less than B (A < B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
-
classmethod
less_int_int
(a, b) → bool¶ Returns true if A is less than B (A < B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
-
classmethod
less_less_vector_rotator
(a, b) → Vector¶ Returns result of vector A rotated by the inverse of Rotator B
-
classmethod
line_plane_intersection
(line_start, line_end, a_plane) → (t=float, intersection=Vector) or None¶ Computes the intersection point between a line and a plane.
-
classmethod
line_plane_intersection_origin_normal
(line_start, line_end, plane_origin, plane_normal) → (t=float, intersection=Vector) or None¶ Computes the intersection point between a line and a plane.
- Parameters
- Returns
True if the intersection test was successful.
t (float): The t of the intersection between the line and the plane
intersection (Vector): The point of intersection between the line and the plane
- Return type
tuple or None
-
classmethod
linear_color_desaturated
(color, desaturation) → LinearColor¶ Returns a desaturated color, with 0 meaning no desaturation and 1 == full desaturation
- Parameters
color (LinearColor) –
desaturation (float) –
- Returns
Desaturated color
- Return type
-
classmethod
linear_color_distance
(c1, c2) → float¶ Euclidean distance between two color points.
- Parameters
c1 (LinearColor) –
c2 (LinearColor) –
- Returns
- Return type
-
classmethod
linear_color_get_luminance
(color) → float¶ Returns the perceived brightness of a color on a display taking into account the impact on the human eye per color channel: green > red > blue.
- Parameters
color (LinearColor) –
- Returns
- Return type
-
classmethod
linear_color_get_max
(color) → float¶ Returns the maximum color channel value in this color structure
- Parameters
color (LinearColor) –
- Returns
The maximum color channel value
- Return type
-
classmethod
linear_color_get_min
(color) → float¶ Returns the minimum color channel value in this color structure
- Parameters
color (LinearColor) –
- Returns
The minimum color channel value
- Return type
-
classmethod
linear_color_is_near_equal
(a, b, tolerance=0.0001) → bool¶ Returns true if linear color A is equal to linear color B (A == B) within a specified error tolerance
- Parameters
a (LinearColor) –
b (LinearColor) –
tolerance (float) –
- Returns
- Return type
-
classmethod
linear_color_lerp
(a, b, alpha) → LinearColor¶ Linearly interpolates between A and B based on Alpha (100% of A when Alpha=0 and 100% of B when Alpha=1)
- Parameters
a (LinearColor) –
b (LinearColor) –
alpha (float) –
- Returns
- Return type
-
classmethod
linear_color_lerp_using_hsv
(a, b, alpha) → LinearColor¶ Linearly interpolates between two colors by the specified Alpha amount (100% of A when Alpha=0 and 100% of B when Alpha=1). The interpolation is performed in HSV color space taking the shortest path to the new color’s hue. This can give better results than a normal lerp, but is much more expensive. The incoming colors are in RGB space, and the output color will be RGB. The alpha value will also be interpolated.
- Parameters
a (LinearColor) – The color and alpha to interpolate from as linear RGBA
b (LinearColor) – The color and alpha to interpolate to as linear RGBA
alpha (float) – Scalar interpolation amount (usually between 0.0 and 1.0 inclusive)
- Returns
The interpolated color in linear RGB space along with the interpolated alpha value
- Return type
-
classmethod
linear_color_quantize
(color) → Color¶ Quantizes the linear color and returns the result as an 8-bit color. This bypasses the SRGB conversion.
- Parameters
color (LinearColor) –
- Returns
- Return type
-
classmethod
linear_color_quantize_round
(color) → Color¶ Quantizes the linear color with rounding and returns the result as an 8-bit color. This bypasses the SRGB conversion.
- Parameters
color (LinearColor) –
- Returns
- Return type
-
classmethod
linear_color_set
(out_color, color) → LinearColor¶ Assign contents of InColor
- Parameters
out_color (LinearColor) –
color (LinearColor) –
- Returns
out_color (LinearColor):
- Return type
-
classmethod
linear_color_set_from_hsv
(out_color, h, s, v, a=1.0) → LinearColor¶ Assigns an HSV color to a linear space RGB color
- Parameters
out_color (LinearColor) –
h (float) –
s (float) –
v (float) –
a (float) –
- Returns
out_color (LinearColor):
- Return type
-
classmethod
linear_color_set_from_pow22
(out_color, color) → LinearColor¶ Assigns an FColor coming from an observed Pow(1/2.2) output, into a linear color.
- Parameters
out_color (LinearColor) –
color (Color) – The Pow(1/2.2) color that needs to be converted into linear space.
- Returns
out_color (LinearColor):
- Return type
-
classmethod
linear_color_set_from_srgb
(out_color, srgb) → LinearColor¶ Assigns an FColor coming from an observed sRGB output, into a linear color.
- Parameters
out_color (LinearColor) –
srgb (Color) – The sRGB color that needs to be converted into linear space.
- Returns
out_color (LinearColor):
- Return type
-
classmethod
linear_color_set_random_hue
(out_color) → LinearColor¶ Sets to a random color. Choses a quite nice color based on a random hue.
- Parameters
out_color (LinearColor) –
- Returns
out_color (LinearColor):
- Return type
-
classmethod
linear_color_set_rgba
(out_color, r, g, b, a=1.0) → LinearColor¶ Assign individual linear RGBA components.
- Parameters
out_color (LinearColor) –
r (float) –
g (float) –
b (float) –
a (float) –
- Returns
out_color (LinearColor):
- Return type
-
classmethod
linear_color_set_temperature
(out_color, temperature) → LinearColor¶ Converts temperature in Kelvins of a black body radiator to RGB chromaticity.
- Parameters
out_color (LinearColor) –
temperature (float) –
- Returns
out_color (LinearColor):
- Return type
-
classmethod
linear_color_to_new_opacity
(color, opacity) → LinearColor¶ Returns a copy of this color using the specified opacity/alpha.
- Parameters
color (LinearColor) –
opacity (float) –
- Returns
- Return type
-
classmethod
linear_color_to_rgbe
(linear_color) → Color¶ Convert from linear to 8-bit RGBE as outlined in Gregory Ward’s Real Pixels article, Graphics Gems II, page 80.
- Parameters
linear_color (LinearColor) –
- Returns
- Return type
-
classmethod
make_plane_from_point_and_normal
(point, normal) → Plane¶ Creates a plane with a facing direction of Normal at the given Point
-
classmethod
make_pulsating_value
(current_time, pulses_per_second=1.0, phase=0.0) → float¶ Simple function to create a pulsating scalar value
-
classmethod
make_relative_transform
(a, relative_to) → Transform¶ Computes a relative transform of one transform compared to another.
Example: ChildOffset = MakeRelativeTransform(Child.GetActorTransform(), Parent.GetActorTransform()) This computes the relative transform of the Child from the Parent.
-
classmethod
make_rot_from_x
(x) → Rotator¶ Builds a rotator given only a XAxis. Y and Z are unspecified but will be orthonormal. XAxis need not be normalized.
-
classmethod
make_rot_from_xy
(x, y) → Rotator¶ Builds a matrix with given X and Y axes. X will remain fixed, Y may be changed minimally to enforce orthogonality. Z will be computed. Inputs need not be normalized.
-
classmethod
make_rot_from_xz
(x, z) → Rotator¶ Builds a matrix with given X and Z axes. X will remain fixed, Z may be changed minimally to enforce orthogonality. Y will be computed. Inputs need not be normalized.
-
classmethod
make_rot_from_y
(y) → Rotator¶ Builds a rotation matrix given only a YAxis. X and Z are unspecified but will be orthonormal. YAxis need not be normalized.
-
classmethod
make_rot_from_yx
(y, x) → Rotator¶ Builds a matrix with given Y and X axes. Y will remain fixed, X may be changed minimally to enforce orthogonality. Z will be computed. Inputs need not be normalized.
-
classmethod
make_rot_from_yz
(y, z) → Rotator¶ Builds a matrix with given Y and Z axes. Y will remain fixed, Z may be changed minimally to enforce orthogonality. X will be computed. Inputs need not be normalized.
-
classmethod
make_rot_from_z
(z) → Rotator¶ Builds a rotation matrix given only a ZAxis. X and Y are unspecified but will be orthonormal. ZAxis need not be normalized.
-
classmethod
make_rot_from_zx
(z, x) → Rotator¶ Builds a matrix with given Z and X axes. Z will remain fixed, X may be changed minimally to enforce orthogonality. Y will be computed. Inputs need not be normalized.
-
classmethod
make_rot_from_zy
(z, y) → Rotator¶ Builds a matrix with given Z and Y axes. Z will remain fixed, Y may be changed minimally to enforce orthogonality. X will be computed. Inputs need not be normalized.
-
classmethod
make_rotation_from_axes
(forward, right, up) → Rotator¶ Build a reference frame from three axes
-
classmethod
map_range
(value, range_a, range_b, out_range_a, out_range_b)¶ deprecated: ‘map_range’ was renamed to ‘map_range_unclamped’.
-
classmethod
map_range_clamped
(value, range_a, range_b, out_range_a, out_range_b) → float¶ Returns Value mapped from one range into another where the Value is clamped to the Input Range. (e.g. 0.5 normalized from the range 0->1 to 0->50 would result in 25)
-
classmethod
map_range_unclamped
(value, range_a, range_b, out_range_a, out_range_b) → float¶ Returns Value mapped from one range into another. (e.g. 20 normalized from the range 10->50 to 20->40 would result in 25)
-
classmethod
matrix_apply_scale
(m, scale) → Matrix¶ Apply Scale to this matrix (Assumes Matrix represents a transform)
-
classmethod
matrix_concatenate_translation
(m, translation) → Matrix¶ Returns a matrix with an additional translation concatenated. (Assumes Matrix represents a transform)
-
classmethod
matrix_get_column
(m, column) → Vector¶ get a column of this matrix
- Parameters
m (Matrix) –
column (MatrixColumns) –
- Returns
vector of the column
- Return type
-
classmethod
matrix_get_frustum_bottom_plane
(m) → Plane or None¶ Get the bottom plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)
-
classmethod
matrix_get_frustum_far_plane
(m) → Plane or None¶ Get the far plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)
-
classmethod
matrix_get_frustum_left_plane
(m) → Plane or None¶ Get the left plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)
-
classmethod
matrix_get_frustum_near_plane
(m) → Plane or None¶ Get the near plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)
-
classmethod
matrix_get_frustum_right_plane
(m) → Plane or None¶ Get the right plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)
-
classmethod
matrix_get_frustum_top_plane
(m) → Plane or None¶ Get the top plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)
-
classmethod
matrix_get_matrix_without_scale
(m, tolerance=0.0) → Matrix¶ Returns matrix after RemoveScaling with error Tolerance (Assumes Matrix represents a transform)
-
classmethod
matrix_get_origin
(matrix) → Vector¶ Get the origin of the co-ordinate system (Assumes Matrix represents a transform)
-
classmethod
matrix_get_rotator
(m) → Rotator¶ Get the rotator representation of this matrix (Assumes Matrix represents a transform)
-
classmethod
matrix_get_scale_vector
(m, tolerance=0.0) → Vector¶ return a 3D scale vector calculated from this matrix (where each component is the magnitude of a row vector) with error Tolerance. (Assumes Matrix represents a transform)
-
classmethod
matrix_get_scaled_axes
(m) -> (x=Vector, y=Vector, z=Vector)¶ get axes of this matrix scaled by the scale of the matrix (Assumes Matrix represents a transform)
- Parameters
m (Matrix) –
- Returns
x (Vector): axes returned to this param
y (Vector): axes returned to this param
z (Vector): axes returned to this param
- Return type
tuple
-
classmethod
matrix_get_scaled_axis
(m, axis) → Vector¶ get axis of this matrix scaled by the scale of the matrix (Assumes Matrix represents a transform)
-
classmethod
matrix_get_unit_axes
(m) -> (x=Vector, y=Vector, z=Vector)¶ get unit length axes of this matrix (Assumes Matrix represents a transform)
- Parameters
m (Matrix) –
- Returns
x (Vector): axes returned to this param
y (Vector): axes returned to this param
z (Vector): axes returned to this param
- Return type
tuple
-
classmethod
matrix_get_unit_axis
(m, axis) → Vector¶ get unit length axis of this matrix (Assumes Matrix represents a transform)
-
classmethod
matrix_inverse_transform_position
(m, v) → Vector¶ Inverts the matrix and then transforms V - correctly handles scaling in this matrix. (Assumes Matrix represents a transform)
-
classmethod
matrix_inverse_transform_vector
(m, v) → Vector¶ Transform a direction vector by the inverse of this matrix - will not take into account translation part. If you want to transform a surface normal (or plane) and correctly account for non-uniform scaling you should use TransformByUsingAdjointT with adjoint of matrix inverse. (Assumes Matrix represents a transform)
-
classmethod
matrix_mirror
(m, mirror_axis, flip_axis) → Matrix¶ Utility for mirroring this transform across a certain plane, and flipping one of the axis as well. (Assumes Matrix represents a transform)
-
classmethod
matrix_remove_scaling
(m, tolerance=0.0) → Matrix¶ Remove any scaling from this matrix (ie magnitude of each row is 1) with error Tolerance (Assumes Matrix represents a transform)
-
classmethod
matrix_remove_translation
(m) → Matrix¶ Remove any translation from this matrix (Assumes Matrix represents a transform)
-
classmethod
matrix_scale_translation
(m, scale3d) → Matrix¶ Scale the translation part of the matrix by the supplied vector. (Assumes Matrix represents a transform)
-
classmethod
matrix_set_axis
(m, axis, axis_vector) → Matrix¶ set an axis of this matrix (Assumes Matrix represents a transform)
-
classmethod
matrix_set_column
(m, column, value) → Matrix¶ Matrix Set Column
- Parameters
m (Matrix) –
column (MatrixColumns) –
value (Vector) –
- Returns
m (Matrix):
- Return type
-
classmethod
matrix_set_origin
(m, new_origin) → Matrix¶ Set the origin of the coordinate system to the given vector (Assumes Matrix represents a transform)
-
classmethod
matrix_to_quat
(m) → Quat¶ Transform a rotation matrix into a quaternion. (Assumes Matrix represents a transform) rotation part will need to be unit length for this to be right!:
-
classmethod
matrix_transform_position
(m, v) → Vector4¶ Transform a location - will take into account translation part of the FMatrix. (Assumes Matrix represents a transform)
-
classmethod
matrix_transform_vector
(m, v) → Vector4¶ Transform a direction vector - will not take into account translation part of the FMatrix. If you want to transform a surface normal (or plane) and correctly account for non-uniform scaling you should use TransformByUsingAdjointT. (Assumes Matrix represents a transform)
-
classmethod
matrix_transform_vector4
(m, v) → Vector4¶ Transform a vector by the matrix. (Assumes Matrix represents a transform)
-
classmethod
max
(a, b) → int32¶ Returns the maximum value of A and B
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
int32
-
classmethod
max_int64
(a, b) → int64¶ Returns the maximum value of A and B
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
int64
-
classmethod
max_of_byte_array
(byte_array) -> (index_of_max_value=int32, max_value=uint8)¶ Returns max of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.
- Parameters
byte_array (Array(uint8)) –
- Returns
index_of_max_value (int32):
max_value (uint8):
- Return type
tuple
-
classmethod
max_of_float_array
(float_array) -> (index_of_max_value=int32, max_value=float)¶ Returns max of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.
-
classmethod
max_of_int_array
(int_array) -> (index_of_max_value=int32, max_value=int32)¶ Returns max of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.
- Parameters
int_array (Array(int32)) –
- Returns
index_of_max_value (int32):
max_value (int32):
- Return type
tuple
-
classmethod
min
(a, b) → int32¶ Returns the minimum value of A and B
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
int32
-
classmethod
min_int64
(a, b) → int64¶ Returns the minimum value of A and B
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
int64
-
classmethod
min_of_byte_array
(byte_array) -> (index_of_min_value=int32, min_value=uint8)¶ Returns min of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.
- Parameters
byte_array (Array(uint8)) –
- Returns
index_of_min_value (int32):
min_value (uint8):
- Return type
tuple
-
classmethod
min_of_float_array
(float_array) -> (index_of_min_value=int32, min_value=float)¶ Returns min of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.
-
classmethod
min_of_int_array
(int_array) -> (index_of_min_value=int32, min_value=int32)¶ Returns min of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.
- Parameters
int_array (Array(int32)) –
- Returns
index_of_min_value (int32):
min_value (int32):
- Return type
tuple
-
classmethod
minimum_area_rectangle
(world_context_object, verts, sample_surface_normal, debug_draw=False) -> (out_rect_center=Vector, out_rect_rotation=Rotator, out_side_length_x=float, out_side_length_y=float)¶ Finds the minimum area rectangle that encloses all of the points in InVerts Uses algorithm found in http://www.geometrictools.com/Documentation/MinimumAreaRectangle.pdf OutRectCenter - Center of the enclosing rectangle: OutRectSideA - Vector oriented and sized to represent one edge of the enclosing rectangle, orthogonal to OutRectSideB: OutRectSideB - Vector oriented and sized to represent one edge of the enclosing rectangle, orthogonal to OutRectSideA:
-
classmethod
mirror_vector_by_normal
(vect, normal) → Vector¶ Given a direction vector and a surface normal, returns the vector reflected across the surface normal. Produces a result like shining a laser at a mirror!
-
classmethod
multiply_byte_byte
(a, b) → uint8¶ Multiplication (A * B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
uint8
-
classmethod
multiply_int64_int64
(a, b) → int64¶ Multiplication (A * B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
int64
-
classmethod
multiply_int_int
(a, b) → int32¶ Multiplication (A * B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
int32
-
classmethod
multiply_linear_color_float
(a, b) → LinearColor¶ Element-wise multiplication of a linear color by a float (F*R, F*G, F*B, F*A)
- Parameters
a (LinearColor) –
b (float) –
- Returns
- Return type
-
classmethod
multiply_linear_color_linear_color
(a, b) → LinearColor¶ Element-wise multiplication of two linear colors (R*R, G*G, B*B, A*A)
- Parameters
a (LinearColor) –
b (LinearColor) –
- Returns
- Return type
-
classmethod
multiply_matrix_float
(a, b) → Matrix¶ Multiplies all values of the matrix by a float. If your Matrix represents a Transform that you wish to scale you should use Apply Scale instead
-
classmethod
multiply_quat_quat
(a, b) → Quat¶ Gets the result of multiplying two quaternions (A * B).
Order matters when composing quaternions: C = A * B will yield a quaternion C that logically first applies B then A to any subsequent transformation (right first, then left).
-
classmethod
multiply_rotator_float
(a, b) → Rotator¶ Returns rotator representing rotator A scaled by B
-
classmethod
multiply_rotator_int
(a, b) → Rotator¶ Returns rotator representing rotator A scaled by B
-
classmethod
multiply_vector2d_vector2d
(a, b) → Vector2D¶ Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y})
-
classmethod
multiply_vector4_vector4
(a, b) → Vector4¶ Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y, A.z*B.z, A.w*B.w})
-
classmethod
multiply_vector_vector
(a, b) → Vector¶ Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y, A.z*B.z})
-
classmethod
nearly_equal_float_float
(a, b, error_tolerance=1e-06) → bool¶ Returns true if A is nearly equal to B (|A - B| < ErrorTolerance)
-
classmethod
nearly_equal_rotator_rotator
(a, b, error_tolerance=0.0001)¶ deprecated: ‘nearly_equal_rotator_rotator’ was renamed to ‘equal_equal_rotator_rotator’.
-
classmethod
nearly_equal_transform_transform
(a, b, location_tolerance=0.0001, rotation_tolerance=0.0001, scale3d_tolerance=0.0001) → bool¶ Returns true if transform A is nearly equal to B
- Parameters
a (Transform) –
b (Transform) –
location_tolerance (float) – How close position of transforms need to be to be considered equal
rotation_tolerance (float) – How close rotations of transforms need to be to be considered equal
scale3d_tolerance (float) – How close scale of transforms need to be to be considered equal
- Returns
- Return type
-
classmethod
nearly_equal_vector_vector
(a, b, error_tolerance=0.0001)¶ deprecated: ‘nearly_equal_vector_vector’ was renamed to ‘equal_equal_vector_vector’.
-
classmethod
normal
(a, tolerance=0.0001) → Vector¶ Gets a normalized unit copy of the vector, ensuring it is safe to do so based on the length. Returns zero vector if vector length is too small to safely normalize.
-
classmethod
normal_safe2d
(a, tolerance=0.0) → Vector2D¶ Gets a normalized copy of the vector, checking it is safe to do so based on the length. Returns zero vector if vector length is too small to safely normalize.
-
classmethod
normalize2d
(a, tolerance=0.0) → Vector2D¶ Normalize this vector in-place if it is large enough, set it to (0,0) otherwise. NormalSafe2D():
-
classmethod
normalize_to_range
(value, range_min, range_max) → float¶ Returns Value normalized to the given range. (e.g. 20 normalized to the range 10->50 would result in 0.25)
-
classmethod
not_equal_byte_byte
(a, b) → bool¶ Returns true if A is not equal to B (A != B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
-
classmethod
not_equal_date_time_date_time
(a, b) → bool¶ Returns true if the values are not equal (A != B)
-
classmethod
not_equal_exactly_vector2d_vector2d
(a, b) → bool¶ Returns true if vector2D A is not equal to vector2D B (A != B) within a specified error tolerance
-
classmethod
not_equal_exactly_vector4_vector4
(a, b) → bool¶ Returns true if vector A is not equal to vector B (A != B) within a specified error tolerance
-
classmethod
not_equal_exactly_vector_vector
(a, b) → bool¶ Returns true if vector A is not equal to vector B (A != B)
-
classmethod
not_equal_int64_int64
(a, b) → bool¶ Returns true if A is not equal to B (A != B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
-
classmethod
not_equal_int_int
(a, b) → bool¶ Returns true if A is not equal to B (A != B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
-
classmethod
not_equal_int_point_int_point
(a, b) → bool¶ Returns true if IntPoint A is NOT equal to IntPoint B (A != B)
-
classmethod
not_equal_linear_color_linear_color
(a, b) → bool¶ Returns true if linear color A is not equal to linear color B (A != B) within a specified error tolerance
- Parameters
a (LinearColor) –
b (LinearColor) –
- Returns
- Return type
-
classmethod
not_equal_matrix_matrix
(a, b, tolerance=0.0001) → bool¶ Checks whether another Matrix is not equal to this, within specified tolerance.
-
classmethod
not_equal_quat_quat
(a, b, error_tolerance=0.0001) → bool¶ Returns true if Quat A is not equal to Quat B (A != B) within a specified error tolerance
-
classmethod
not_equal_rotator_rotator
(a, b, error_tolerance=0.0001) → bool¶ Returns true if rotator A is not equal to rotator B (A != B) within a specified error tolerance
-
classmethod
not_equal_timespan_timespan
(a, b) → bool¶ Returns true if the values are not equal (A != B)
-
classmethod
not_equal_vector2d_vector2d
(a, b, error_tolerance=0.0001) → bool¶ Returns true if vector2D A is not equal to vector2D B (A != B) within a specified error tolerance
-
classmethod
not_equal_vector4_vector4
(a, b, error_tolerance=0.0001) → bool¶ Returns true if vector A is not equal to vector B (A != B) within a specified error tolerance
-
classmethod
not_equal_vector_vector
(a, b, error_tolerance=0.0001) → bool¶ Returns true if vector A is not equal to vector B (A != B) within a specified error tolerance
-
classmethod
not_int
(a) → int32¶ Bitwise NOT (~A)
- Parameters
a (int32) –
- Returns
- Return type
int32
-
classmethod
not_int64
(a) → int64¶ Bitwise NOT (~A)
- Parameters
a (int64) –
- Returns
- Return type
int64
-
classmethod
or_int64_int64
(a, b) → int64¶ Bitwise OR (A | B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
int64
-
classmethod
or_int_int
(a, b) → int32¶ Bitwise OR (A | B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
int32
-
classmethod
percent_byte_byte
(a, b=1) → uint8¶ Modulo (A % B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
uint8
-
classmethod
percent_int_int
(a, b=1) → int32¶ Modulo (A % B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
int32
-
classmethod
perlin_noise1d
(value) → float¶ Generates a 1D Perlin noise from the given value. Returns a continuous random value between -1.0 and 1.0.
-
classmethod
points_are_coplanar
(points, tolerance=0.1) → bool¶ Determines whether a given set of points are coplanar, with a tolerance. Any three points or less are always coplanar.
-
classmethod
project_on_to
(v, target)¶ deprecated: ‘project_on_to’ was renamed to ‘project_vector_on_to_vector’.
-
classmethod
project_point_on_to_plane
(point, plane_base, plane_normal) → Vector¶ Projects/snaps a point onto a plane defined by a point on the plane and a plane normal.
-
classmethod
project_vector_on_to_plane
(v, plane_normal) → Vector¶ Projects a vector onto a plane defined by a normalized vector (PlaneNormal).
-
classmethod
project_vector_on_to_vector
(v, target) → Vector¶ Projects one vector (V) onto another (Target) and returns the projected vector. If Target is nearly zero in length, returns the zero vector.
-
classmethod
quat_angular_distance
(a, b) → float¶ Find the angular distance/difference between two rotation quaternions.
-
classmethod
quat_enforce_shortest_arc_with
(a, b) → Quat¶ Modify the quaternion to ensure that the delta between it and B represents the shortest possible rotation angle.
-
classmethod
quat_euler
(q) → Vector¶ Convert a Quaternion into floating-point Euler angles (in degrees).
-
classmethod
quat_exp
(q) → Quat¶ Used in combination with Log(). Assumes a quaternion with W=0 and V=theta*v (where |v| = 1). Exp(q) = (sin(theta)*v, cos(theta))
-
classmethod
quat_get_axis_x
(q) → Vector¶ Get the forward direction (X axis) after it has been rotated by this Quaternion.
-
classmethod
quat_get_axis_y
(q) → Vector¶ Get the right direction (Y axis) after it has been rotated by this Quaternion.
-
classmethod
quat_get_axis_z
(q) → Vector¶ Get the up direction (Z axis) after it has been rotated by this Quaternion.
-
classmethod
quat_get_rotation_axis
(q) → Vector¶ Get the axis of rotation of the Quaternion. This is the axis around which rotation occurs to transform the canonical coordinate system to the target orientation. For the identity Quaternion which has no such rotation, FVector(1,0,0) is returned.
-
classmethod
quat_is_finite
(q) → bool¶ Determine if all the values are finite (not NaN nor Inf) in this Quat.
-
classmethod
quat_is_identity
(q, tolerance=0.0001) → bool¶ Checks whether this Quaternion is an Identity Quaternion. Assumes Quaternion tested is normalized.
-
classmethod
quat_is_non_finite
(q) → bool¶ Determine if there are any non-finite values (NaN or Inf) in this Quat.
-
classmethod
quat_make_from_euler
(euler) → Quat¶ Convert a vector of floating-point Euler angles (in degrees) into a Quaternion.
-
classmethod
quat_normalize
(q, tolerance=0.0001) → Quat¶ Normalize this quaternion if it is large enough as compared to the supplied tolerance. If it is too small then set it to the identity quaternion.
-
classmethod
quat_normalized
(q, tolerance=0.0001) → Quat¶ Get a normalized copy of this quaternion. If it is too small, returns an identity quaternion.
-
classmethod
quat_set_from_euler
(q, euler) → Quat¶ Convert a vector of floating-point Euler angles (in degrees) into a Quaternion.
-
classmethod
quat_vector_forward
(q) → Vector¶ Get the forward direction (X axis) after it has been rotated by this Quaternion.
-
classmethod
quat_vector_right
(q) → Vector¶ Get the right direction (Y axis) after it has been rotated by this Quaternion.
-
classmethod
quat_vector_up
(q) → Vector¶ Get the up direction (Z axis) after it has been rotated by this Quaternion.
-
classmethod
r_interp_to
(current, target, delta_time, interp_speed) → Rotator¶ Tries to reach Target rotation based on Current rotation, giving a nice smooth feeling when rotating to Target rotation.
-
classmethod
r_interp_to_constant
(current, target, delta_time, interp_speed) → Rotator¶ Tries to reach Target rotation at a constant rate.
-
classmethod
r_lerp
(a, b, alpha, shortest_path) → Rotator¶ Linearly interpolates between A and B based on Alpha (100% of A when Alpha=0 and 100% of B when Alpha=1)
-
classmethod
rand
(max)¶ deprecated: ‘rand’ was renamed to ‘random_integer’.
-
classmethod
rand_bool
()¶ deprecated: ‘rand_bool’ was renamed to ‘random_bool’.
-
classmethod
rand_bool_from_stream
(stream)¶ deprecated: ‘rand_bool_from_stream’ was renamed to ‘random_bool_from_stream’.
-
classmethod
rand_from_stream
(max, stream)¶ deprecated: ‘rand_from_stream’ was renamed to ‘random_integer_from_stream’.
-
classmethod
rand_range
(min, max)¶ deprecated: ‘rand_range’ was renamed to ‘random_integer_in_range’.
-
classmethod
rand_range_from_stream
(min, max, stream)¶ deprecated: ‘rand_range_from_stream’ was renamed to ‘random_integer_in_range_from_stream’.
-
classmethod
random_bool_from_stream
(stream) → bool¶ Returns a random bool
- Parameters
stream (RandomStream) –
- Returns
- Return type
-
classmethod
random_bool_with_weight
(weight) → bool¶ - Get a random chance with the specified weight. Range of weight is 0.0 - 1.0 E.g.,
Weight = .6 return value = True 60% of the time
-
classmethod
random_bool_with_weight_from_stream
(weight, random_stream) → bool¶ - Get a random chance with the specified weight. Range of weight is 0.0 - 1.0 E.g.,
Weight = .6 return value = True 60% of the time
- Parameters
weight (float) –
random_stream (RandomStream) –
- Returns
- Return type
-
classmethod
random_float_from_stream
(stream) → float¶ Returns a random float between 0 and 1
- Parameters
stream (RandomStream) –
- Returns
- Return type
-
classmethod
random_float_in_range_from_stream
(min, max, stream) → float¶ Generate a random number between Min and Max
- Parameters
min (float) –
max (float) –
stream (RandomStream) –
- Returns
- Return type
-
classmethod
random_integer
(max) → int32¶ Returns a uniformly distributed random number between 0 and Max - 1
- Parameters
max (int32) –
- Returns
- Return type
int32
-
classmethod
random_integer64
(max) → int64¶ Returns a uniformly distributed random number between 0 and Max - 1
- Parameters
max (int64) –
- Returns
- Return type
int64
-
classmethod
random_integer64_in_range
(min, max) → int64¶ Return a random integer64 between Min and Max (>= Min and <= Max)
- Parameters
min (int64) –
max (int64) –
- Returns
- Return type
int64
-
classmethod
random_integer_from_stream
(max, stream) → int32¶ Returns a uniformly distributed random number between 0 and Max - 1
- Parameters
max (int32) –
stream (RandomStream) –
- Returns
- Return type
int32
-
classmethod
random_integer_in_range
(min, max) → int32¶ Return a random integer between Min and Max (>= Min and <= Max)
- Parameters
min (int32) –
max (int32) –
- Returns
- Return type
int32
-
classmethod
random_integer_in_range_from_stream
(min, max, stream) → int32¶ Return a random integer between Min and Max (>= Min and <= Max)
- Parameters
min (int32) –
max (int32) –
stream (RandomStream) –
- Returns
- Return type
int32
-
classmethod
random_point_in_bounding_box
(origin, box_extent) → Vector¶ Returns a random point within the specified bounding box using the first vector as an origin and the second as the box extents.
-
classmethod
random_rotator
(roll=False) → Rotator¶ Generates a random rotation, with optional random roll.
-
classmethod
random_rotator_from_stream
(roll, stream) → Rotator¶ Create a random rotation
- Parameters
roll (bool) –
stream (RandomStream) –
- Returns
- Return type
-
classmethod
random_unit_vector
() → Vector¶ Returns a random vector with length of 1
- Returns
- Return type
-
classmethod
random_unit_vector_from_stream
(stream) → Vector¶ Returns a random vector with length of 1.0
- Parameters
stream (RandomStream) –
- Returns
- Return type
-
classmethod
random_unit_vector_in_cone
(cone_dir, cone_half_angle_in_radians)¶ deprecated: ‘random_unit_vector_in_cone’ was renamed to ‘random_unit_vector_in_cone_in_radians’.
-
classmethod
random_unit_vector_in_cone_in_degrees
(cone_dir, cone_half_angle_in_degrees) → Vector¶ Returns a random vector with length of 1, within the specified cone, with uniform random distribution.
-
classmethod
random_unit_vector_in_cone_in_degrees_from_stream
(cone_dir, cone_half_angle_in_degrees, stream) → Vector¶ Returns a random vector with length of 1, within the specified cone, with uniform random distribution.
- Parameters
cone_dir (Vector) – The base “center” direction of the cone.
cone_half_angle_in_degrees (float) – The half-angle of the cone (from ConeDir to edge), in degrees.
stream (RandomStream) – The random stream from which to obtain the vector.
- Returns
- Return type
-
classmethod
random_unit_vector_in_cone_in_radians
(cone_dir, cone_half_angle_in_radians) → Vector¶ Returns a random vector with length of 1, within the specified cone, with uniform random distribution.
-
classmethod
random_unit_vector_in_cone_in_radians_from_stream
(cone_dir, cone_half_angle_in_radians, stream) → Vector¶ Returns a random vector with length of 1, within the specified cone, with uniform random distribution.
- Parameters
cone_dir (Vector) – The base “center” direction of the cone.
cone_half_angle_in_radians (float) – The half-angle of the cone (from ConeDir to edge), in radians.
stream (RandomStream) – The random stream from which to obtain the vector.
- Returns
- Return type
-
classmethod
random_unit_vector_in_cone_with_yaw_and_pitch
(cone_dir, max_yaw_in_degrees, max_pitch_in_degrees)¶ deprecated: ‘random_unit_vector_in_cone_with_yaw_and_pitch’ was renamed to ‘random_unit_vector_in_elliptical_cone_in_degrees’.
-
classmethod
random_unit_vector_in_elliptical_cone_in_degrees
(cone_dir, max_yaw_in_degrees, max_pitch_in_degrees) → Vector¶ Returns a random vector with length of 1, within the specified cone, with uniform random distribution. The shape of the cone can be modified according to the yaw and pitch angles.
-
classmethod
random_unit_vector_in_elliptical_cone_in_degrees_from_stream
(cone_dir, max_yaw_in_degrees, max_pitch_in_degrees, stream) → Vector¶ Returns a random vector with length of 1, within the specified cone, with uniform random distribution. The shape of the cone can be modified according to the yaw and pitch angles.
- Parameters
cone_dir (Vector) –
max_yaw_in_degrees (float) – The yaw angle of the cone (from ConeDir to horizontal edge), in degrees.
max_pitch_in_degrees (float) – The pitch angle of the cone (from ConeDir to vertical edge), in degrees.
stream (RandomStream) – The random stream from which to obtain the vector.
- Returns
- Return type
-
classmethod
random_unit_vector_in_elliptical_cone_in_radians
(cone_dir, max_yaw_in_radians, max_pitch_in_radians) → Vector¶ Returns a random vector with length of 1, within the specified cone, with uniform random distribution. The shape of the cone can be modified according to the yaw and pitch angles.
-
classmethod
random_unit_vector_in_elliptical_cone_in_radians_from_stream
(cone_dir, max_yaw_in_radians, max_pitch_in_radians, stream) → Vector¶ Returns a random vector with length of 1, within the specified cone, with uniform random distribution. The shape of the cone can be modified according to the yaw and pitch angles.
- Parameters
cone_dir (Vector) –
max_yaw_in_radians (float) – The yaw angle of the cone (from ConeDir to horizontal edge), in radians.
max_pitch_in_radians (float) – The pitch angle of the cone (from ConeDir to vertical edge), in radians.
stream (RandomStream) – The random stream from which to obtain the vector.
- Returns
- Return type
-
classmethod
reset_float_spring_state
(spring_state) → FloatSpringState¶ Resets the state of a given spring
- Parameters
spring_state (FloatSpringState) –
- Returns
spring_state (FloatSpringState):
- Return type
-
classmethod
reset_random_stream
(stream) → None¶ Reset a random stream
- Parameters
stream (RandomStream) –
-
classmethod
reset_vector_spring_state
(spring_state) → VectorSpringState¶ Resets the state of a given spring
- Parameters
spring_state (VectorSpringState) –
- Returns
spring_state (VectorSpringState):
- Return type
-
classmethod
rgb_linear_to_hsv
(rgb) → LinearColor¶ Converts a RGB linear color to HSV (where H is in R, S is in G, and V is in B)
- Parameters
rgb (LinearColor) –
- Returns
- Return type
-
classmethod
rgb_to_hsv
(color) -> (h=float, s=float, v=float, a=float)¶ Breaks apart a color into individual HSV components (as well as alpha) (Hue is [0..360) while Saturation and Value are 0..1)
- Parameters
color (LinearColor) –
- Returns
h (float):
s (float):
v (float):
a (float):
- Return type
tuple
-
classmethod
rgb_to_hsv_vector
(rgb) → LinearColor¶ Converts a RGB linear color to HSV (where H is in R (0..360), S is in G (0..1), and V is in B (0..1))
- Parameters
rgb (LinearColor) –
- Returns
hsv (LinearColor):
- Return type
-
classmethod
rot_rand
(roll=False)¶ deprecated: ‘rot_rand’ was renamed to ‘random_rotator’.
-
classmethod
rot_rand_from_stream
(roll, stream)¶ deprecated: ‘rot_rand_from_stream’ was renamed to ‘random_rotator_from_stream’.
-
classmethod
rotate_angle_axis
(vect, angle_deg, axis) → Vector¶ Returns result of vector A rotated by AngleDeg around Axis
-
classmethod
rotator_from_axis_and_angle
(axis, angle) → Rotator¶ Create a rotation from an this axis and supplied angle (in degrees)
-
classmethod
round
(a) → int32¶ Rounds A to the nearest integer (e.g., -1.6 becomes -2 and 1.6 becomes 2)
- Parameters
a (float) –
- Returns
- Return type
int32
-
classmethod
round64
(a) → int64¶ Rounds A to the nearest integer (e.g., -1.6 becomes -2 and 1.6 becomes 2)
- Parameters
a (float) –
- Returns
- Return type
int64
-
classmethod
seed_random_stream
(stream) → RandomStream¶ Create a new random seed for a random stream
- Parameters
stream (RandomStream) –
- Returns
stream (RandomStream):
- Return type
-
classmethod
select_class
(a, b, select_a)¶ If bPickA is true, A is returned, otherwise B is
-
classmethod
select_color
(a, b, pick_a) → LinearColor¶ If bPickA is true, A is returned, otherwise B is
- Parameters
a (LinearColor) –
b (LinearColor) –
pick_a (bool) –
- Returns
- Return type
-
classmethod
select_int
(a, b, pick_a) → int32¶ If bPickA is true, A is returned, otherwise B is
- Parameters
a (int32) –
b (int32) –
pick_a (bool) –
- Returns
- Return type
int32
-
classmethod
select_object
(a, b, select_a) → Object¶ If bPickA is true, A is returned, otherwise B is
-
classmethod
select_rotator
(a, b, pick_a) → Rotator¶ If bPickA is true, A is returned, otherwise B is
-
classmethod
select_transform
(a, b, pick_a) → Transform¶ If bPickA is true, A is returned, otherwise B is
-
classmethod
set_random_stream_seed
(stream, new_seed) → RandomStream¶ Set the seed of a random stream to a specific number
- Parameters
stream (RandomStream) –
new_seed (int32) –
- Returns
stream (RandomStream):
- Return type
-
classmethod
sign_of_float
(a) → float¶ Sign (float, returns -1 if A < 0, 0 if A is zero, and +1 if A > 0)
-
classmethod
sign_of_integer
(a) → int32¶ Sign (integer, returns -1 if A < 0, 0 if A is zero, and +1 if A > 0)
- Parameters
a (int32) –
- Returns
- Return type
int32
-
classmethod
sign_of_integer64
(a) → int64¶ Sign (integer64, returns -1 if A < 0, 0 if A is zero, and +1 if A > 0)
- Parameters
a (int64) –
- Returns
- Return type
int64
-
classmethod
spherical2d_to_unit_cartesian
(a) → Vector¶ Converts spherical coordinates on the unit sphere into a Cartesian unit length vector.
-
classmethod
subtract_byte_byte
(a, b=1) → uint8¶ Subtraction (A - B)
- Parameters
a (uint8) –
b (uint8) –
- Returns
- Return type
uint8
-
classmethod
subtract_int64_int64
(a, b=1) → int64¶ Subtraction (A - B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
int64
-
classmethod
subtract_int_int
(a, b=1) → int32¶ Subtraction (A - B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
int32
-
classmethod
subtract_linear_color_linear_color
(a, b) → LinearColor¶ Element-wise subtraction of two linear colors (R-R, G-G, B-B, A-A)
- Parameters
a (LinearColor) –
b (LinearColor) –
- Returns
- Return type
-
classmethod
subtract_vector2d_vector2d
(a, b) → Vector2D¶ Returns subtraction of Vector B from Vector A (A - B)
-
classmethod
subtract_vector4_vector4
(a, b) → Vector4¶ Returns subtraction of Vector B from Vector A (A - B)
-
classmethod
subtract_vector_int
(a, b) → Vector¶ Subtracts an integer from each component of a vector
-
classmethod
t_interp_to
(current, target, delta_time, interp_speed) → Transform¶ Tries to reach Target transform based on distance from Current position, giving a nice smooth feeling when tracking a position.
-
classmethod
t_lerp
(a, b, alpha, interp_mode=LerpInterpolationMode.QUAT_INTERP) → Transform¶ Linearly interpolates between A and B based on Alpha (100% of A when Alpha=0 and 100% of B when Alpha=1).
- Parameters
a (Transform) –
b (Transform) –
alpha (float) –
interp_mode (LerpInterpolationMode) –
- Returns
- Return type
-
classmethod
timespan_from_string
(timespan_string) → Timespan or None¶ Converts a time span string to a Timespan object
-
classmethod
timespan_ratio
(a, b) → float¶ Returns the ratio between two time spans (A / B), handles zero values
-
classmethod
to_direction_and_length2d
(a) -> (out_dir=Vector2D, out_length=float)¶ Util to convert this vector into a unit direction vector and its original length.
- Parameters
a (Vector2D) –
- Returns
out_dir (Vector2D): Reference passed in to store unit direction vector.
out_length (float): Reference passed in to store length of the vector.
- Return type
tuple
-
classmethod
to_rounded2d
(a) → Vector2D¶ Get this vector as a vector where each component has been rounded to the nearest int.
-
classmethod
to_sign2d
(a) → Vector2D¶ Get a copy of the vector as sign only. Each component is set to +1 or -1, with the sign of zero treated as +1.
-
classmethod
transform_determinant
(transform) → float¶ Calculates the determinant of the transform (converts to FMatrix internally)
-
classmethod
transform_direction
(t, direction) → Vector¶ Transform a direction vector by the supplied transform - will not change its length. For example, if T was an object’s transform, this would transform a direction from local space to world space.
-
classmethod
transform_location
(t, location) → Vector¶ Transform a position by the supplied transform. For example, if T was an object’s transform, this would transform a position from local space to world space.
-
classmethod
transform_position
(t, location)¶ deprecated: ‘transform_position’ was renamed to ‘transform_location’.
-
classmethod
transform_rotation
(t, rotation) → Rotator¶ Transform a rotator by the supplied transform. For example, if T was an object’s transform, this would transform a rotation from local space to world space.
-
classmethod
transform_vector4
(matrix, vec4) → Vector4¶ Transform the input vector4 by a provided matrix4x4 and returns the resulting vector4.
-
classmethod
utc_now
() → DateTime¶ Returns the UTC date and time on this computer
- Returns
- Return type
-
classmethod
v_interp_to
(current, target, delta_time, interp_speed) → Vector¶ Tries to reach Target based on distance from Current position, giving a nice smooth feeling when tracking a position.
-
classmethod
v_interp_to_constant
(current, target, delta_time, interp_speed) → Vector¶ Tries to reach Target at a constant rate.
-
classmethod
v_lerp
(a, b, alpha) → Vector¶ Linearly interpolates between A and B based on Alpha (100% of A when Alpha=0 and 100% of B when Alpha=1)
-
classmethod
v_rand
()¶ deprecated: ‘v_rand’ was renamed to ‘random_unit_vector’.
-
classmethod
v_rand_from_stream
(stream)¶ deprecated: ‘v_rand_from_stream’ was renamed to ‘random_unit_vector_from_stream’.
-
classmethod
vector2d_interp_to
(current, target, delta_time, interp_speed) → Vector2D¶ Tries to reach Target based on distance from Current position, giving a nice smooth feeling when tracking a position.
-
classmethod
vector2d_interp_to_constant
(current, target, delta_time, interp_speed) → Vector2D¶ Tries to reach Target at a constant rate.
-
classmethod
vector4_cross_product3
(a, b) → Vector4¶ Returns the cross product of two vectors - see http://mathworld.wolfram.com/CrossProduct.html
-
classmethod
vector4_dot_product
(a, b) → float¶ Returns the dot product of two vectors - see http://mathworld.wolfram.com/DotProduct.html
-
classmethod
vector4_dot_product3
(a, b) → float¶ Returns the dot product of two vectors - see http://mathworld.wolfram.com/DotProduct.html The W element is ignored.
-
classmethod
vector4_is_nearly_zero3
(a, tolerance=0.0001) → bool¶ Checks whether vector is near to zero within a specified tolerance. The W element is ignored.
-
classmethod
vector4_is_normal3
(a) → bool¶ Determines if vector is normalized / unit (length 1). The W element is ignored.
-
classmethod
vector4_is_unit3
(a, squared_lenth_tolerance=0.0001) → bool¶ Determines if vector is normalized / unit (length 1) within specified squared tolerance. The W element is ignored.
-
classmethod
vector4_is_zero
(a) → bool¶ Checks whether all components of the vector are exactly zero.
-
classmethod
vector4_mirror_by_vector3
(direction, surface_normal) → Vector4¶ Given a direction vector and a surface normal, returns the vector reflected across the surface normal. Produces a result like shining a laser at a mirror! The W element is ignored.
-
classmethod
vector4_negated
(a) → Vector4¶ Gets a negated copy of the vector. Equivalent to -Vector for scripts.
-
classmethod
vector4_normal3
(a, tolerance=0.0001) → Vector4¶ Gets a normalized unit copy of the vector, ensuring it is safe to do so based on the length. The W element is ignored and the returned vector has W=0. Returns zero vector if vector length is too small to safely normalize.
-
classmethod
vector4_normal_unsafe3
(a) → Vector4¶ Calculates normalized unit version of vector without checking for zero length. The W element is ignored and the returned vector has W=0.
-
classmethod
vector4_normalize3
(a, tolerance=0.0) → Vector4¶ Normalize this vector in-place if it is large enough or set it to (0,0,0,0) otherwise. The W element is ignored and the returned vector has W=0.
-
classmethod
vector4_size_squared3
(a) → float¶ Returns the squared length of the vector. The W element is ignored.
-
classmethod
vector_add_bounded
(a, add_vect, radius) → Vector¶ Add a vector to this and clamp the result to an axis aligned cube centered at the origin.
-
classmethod
vector_bounded_to_box
(vect, box_min, box_max) → Vector¶ Get a copy of this vector, clamped inside of the specified axis aligned cube.
-
classmethod
vector_bounded_to_cube
(vect, radius) → Vector¶ Get a copy of this vector, clamped inside of an axis aligned cube centered at the origin.
-
classmethod
vector_clamp_size2d
(a, min, max) → Vector¶ Create a copy of this vector, with the 2D magnitude/size/length clamped between Min and Max. Z is unchanged.
-
classmethod
vector_clamp_size_max
(a, max) → Vector¶ Create a copy of this vector, with its maximum magnitude/size/length clamped to MaxSize.
-
classmethod
vector_clamp_size_max2d
(a, max) → Vector¶ Create a copy of this vector, with the maximum 2D magnitude/size/length clamped to MaxSize. Z is unchanged.
-
classmethod
vector_component_max
(a, b) → Vector¶ Find the maximum elements (X, Y and Z) between the two vector’s components
-
classmethod
vector_component_min
(a, b) → Vector¶ Find the minimum elements (X, Y and Z) between the two vector’s components
-
classmethod
vector_cosine_angle2d
(a, b) → float¶ Returns the cosine of the angle between this vector and another projected onto the XY plane (no Z).
-
classmethod
vector_distance2d
(v1, v2) → float¶ Euclidean distance between two points in the XY plane (ignoring Z).
-
classmethod
vector_distance2d_squared
(v1, v2) → float¶ Squared euclidean distance between two points in the XY plane (ignoring Z).
-
classmethod
vector_get_abs
(a) → Vector¶ Get a copy of this vector with absolute value of each component.
-
classmethod
vector_get_abs_max
(a) → float¶ Find the maximum absolute element (abs(X), abs(Y) or abs(Z)) of a vector
-
classmethod
vector_get_abs_min
(a) → float¶ Find the minimum absolute element (abs(X), abs(Y) or abs(Z)) of a vector
-
classmethod
vector_get_sign_vector
(a) → Vector¶ Get a copy of the vector as sign only. Each component is set to +1 or -1, with the sign of zero treated as +1.
-
classmethod
vector_is_nearly_zero
(a, tolerance=0.0001) → bool¶ Checks whether vector is near to zero within a specified tolerance.
-
classmethod
vector_is_uniform
(a, tolerance=0.0001) → bool¶ Checks whether all components of this vector are the same, within a tolerance.
-
classmethod
vector_is_unit
(a, squared_lenth_tolerance=0.0001) → bool¶ Determines if vector is normalized / unit (length 1) within specified squared tolerance.
-
classmethod
vector_normal2d
(a, tolerance=0.0001) → Vector¶ Gets a normalized unit copy of the 2D components of the vector, ensuring it is safe to do so. Z is set to zero. Returns zero vector if vector length is too small to normalize.
-
classmethod
vector_normal_unsafe
(a) → Vector¶ Calculates normalized unit version of vector without checking for zero length.
-
classmethod
vector_normalize
(a, tolerance=0.0) → Vector¶ Normalize this vector in-place if it is large enough or set it to (0,0,0) otherwise.
-
classmethod
vector_project_on_to_normal
(v, normal) → Vector¶ Gets a copy of this vector projected onto the input vector, which is assumed to be unit length.
-
classmethod
vector_reciprocal
(a) → Vector¶ Gets the reciprocal of this vector, avoiding division by zero. Zero components are set to BIG_NUMBER.
-
classmethod
vector_snapped_to_grid
(vect, grid_size) → Vector¶ Gets a copy of this vector snapped to a grid.
-
classmethod
vector_spring_interp
(current, target, spring_state, stiffness, critical_damping_factor, delta_time, mass=1.000000) -> (Vector, spring_state=VectorSpringState)¶ Uses a simple spring model to interpolate a vector from Current to Target.
- Parameters
current (Vector) – Current value
target (Vector) – Target value
spring_state (VectorSpringState) – Data related to spring model (velocity, error, etc..) - Create a unique variable per spring
stiffness (float) – How stiff the spring model is (more stiffness means more oscillation around the target value)
critical_damping_factor (float) – How much damping to apply to the spring (0 means no damping, 1 means critically damped which means no oscillation)
delta_time (float) –
mass (float) – Multiplier that acts like mass on a spring
- Returns
spring_state (VectorSpringState):
- Return type
-
classmethod
vector_to_degrees
(a) → Vector¶ Converts a vector containing radian values to a vector containing degree values.
-
classmethod
vector_to_radians
(a) → Vector¶ Converts a vector containing degree values to a vector containing radian values.
-
classmethod
vector_unit_cartesian_to_spherical
(a) → Vector2D¶ Converts a Cartesian unit vector into spherical coordinates on the unit sphere.
-
classmethod
vector_unwind_euler
(a) → Vector¶ When this vector contains Euler angles (degrees), ensure that angles are between +/-180
-
classmethod
weighted_moving_average_f_rotator
(current_sample, previous_sample, weight) → Rotator¶ Calculates the new value in a weighted moving average series using the previous value and the weight
-
classmethod
weighted_moving_average_f_vector
(current_sample, previous_sample, weight) → Vector¶ Calculates the new value in a weighted moving average series using the previous value and the weight
-
classmethod
weighted_moving_average_float
(current_sample, previous_sample, weight) → float¶ Calculates the new value in a weighted moving average series using the previous value and the weight
-
classmethod
wrap
(value, min, max) → int32¶ Returns Value between A and B (inclusive) that wraps around
- Parameters
value (int32) –
min (int32) –
max (int32) –
- Returns
- Return type
int32
-
classmethod
xor_int64_int64
(a, b) → int64¶ Bitwise XOR (A ^ B)
- Parameters
a (int64) –
b (int64) –
- Returns
- Return type
int64
-
classmethod
xor_int_int
(a, b) → int32¶ Bitwise XOR (A ^ B)
- Parameters
a (int32) –
b (int32) –
- Returns
- Return type
int32