Exemplo n.º 1
0
 def _build_polygon_metadata_dictionary(self, polygon_metadata, constraint,
                                        waypoint_index):
     compound_polygon = constraint.geometry.polygon
     if isinstance(compound_polygon, CompoundPolygon):
         for polygon in compound_polygon:
             if len(polygon) > 0:
                 key = polygon
                 if key not in polygon_metadata:
                     center = sum(polygon, Vector3.ZERO()) / len(polygon)
                     polygon_metadata[key] = (center, [])
                 waypoint_indices = polygon_metadata[key][1]
                 waypoint_indices.append(waypoint_index)
             else:
                 sim = self._context.sim
                 logger.error(
                     f'Pool Waypoint Generator: Polygon unexpectedly contains no vertices while drawing debug visuals of ${sim}"s route"',
                     owner='jmorrow')
     else:
         sim = self._context.sim
         logger.error(
             f'Pool Waypoint Generator: Constraint geometry in unexpected format while drawing debug visuals of ${sim}"s route."',
             owner='jmorrow')
Exemplo n.º 2
0
TWO_PI = PI*2
EPSILON = 1.192092896e-07
EPSILON_SQ = EPSILON*EPSILON
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()
VECTOR3_ZERO = Vector3.ZERO()
logger = sims4.log.Logger('Sims4Math')

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

def interpolate(starting_value, ending_value, fraction):
    return (1 - fraction)*starting_value + ending_value*fraction

def linear_seq_gen(start, stop, step, max_count=None):
    delta = stop - start
    num = floor(abs(delta/step))
Exemplo n.º 3
0
 def _get_offset(self, interaction):
     return Vector3.ZERO()