Beispiel #1
0
 def get_footprint_polygon(self, sim_a, sim_b, sim_a_transform,
                           sim_b_transform, routing_surface):
     reserved_space_a = get_default_reserve_space(sim_a.species, sim_a.age)
     reserved_space_b = get_default_reserve_space(sim_b.species, sim_b.age)
     polygon = _generate_poly_points(
         sim_a_transform.translation,
         sim_a_transform.orientation.transform_vector(Vector3.Z_AXIS()),
         sim_b_transform.translation,
         sim_b_transform.orientation.transform_vector(Vector3.Z_AXIS()),
         reserved_space_a.left, reserved_space_a.right,
         reserved_space_a.front, reserved_space_a.back,
         reserved_space_b.left, reserved_space_b.right,
         reserved_space_b.front, reserved_space_b.back)
     return PolygonFootprint(
         polygon,
         routing_surface=sim_a.routing_surface,
         cost=25,
         footprint_type=FootprintType.FOOTPRINT_TYPE_OBJECT,
         enabled=True)
 def get_quadtree_polygon(self, position, orientation):
     length_vector = orientation.transform_vector(
         Vector3.Z_AXIS()) * self.length / 2
     return build_rectangle_from_two_points_and_radius(
         position + length_vector, position - length_vector, self.width)
Beispiel #3
0
import native.animation
import sims4.hash_util
from singletons import DEFAULT
TWO_PI = PI * 2
EPSILON = 1.192092896e-07
QUATERNION_EPSILON = 0.001
MAX_FLOAT = 3.402823466e+38
MAX_UINT64 = 18446744073709551615
MAX_INT64 = 922337203685477580
MAX_UINT32 = 4294967295
MAX_INT32 = 2147483647
MAX_UINT16 = 65535
MAX_INT16 = 32767
POS_INFINITY = float('inf')
NEG_INFINITY = float('-inf')
FORWARD_AXIS = Vector3.Z_AXIS()
UP_AXIS = Vector3.Y_AXIS()


def clamp(lower_bound, x, upper_bound):
    if x < lower_bound:
        return lower_bound
    if x > upper_bound:
        return upper_bound
    return x


def interpolate(a, b, fraction):
    return a * fraction + (1 - fraction) * b