def add_rect(self, x, y, z, w, h, d, actuation, ptype=1):
    if (ptype == 0):
        assert (actuation == (- 1))
    global n_particles
    density = 3
    w_count = int(((w / dx) * density))
    h_count = int(((h / dx) * density))
    d_count = int(((d / dx) * density))
    real_dx = (w / w_count)
    real_dy = (h / h_count)
    real_dz = (d / d_count)
    if (ptype == 1):
        for i in range(w_count):
            for j in range(h_count):
                for k in range(d_count):
                    self.x.append([((x + ((i + 0.5) * real_dx)) + self.offset_x), ((y + ((j + 0.5) * real_dy)) + self.offset_y), ((z + ((k + 0.5) * real_dz)) + self.offset_z)])
                    self.actuator_id.append(actuation)
                    self.particle_type.append(ptype)
                    self.n_particles += 1
                    self.n_solid_particles += int((ptype == 1))
                    if ((self.n_particles % 1000) == 0):
                        print('num particles', self.n_particles)
    else:
        for i in range(w_count):
            for j in range(h_count):
                for k in range(d_count):
                    self.x.append([((x + (random.random() * w)) + self.offset_x), ((y + (random.random() * h)) + self.offset_y), ((z + (random.random() * d)) + self.offset_z)])
                    self.actuator_id.append(actuation)
                    self.particle_type.append(ptype)
                    self.n_particles += 1
                    self.n_solid_particles += int((ptype == 1))
                    if ((self.n_particles % 1000) == 0):
                        print('num particles', self.n_particles)
def add_rect(self, x, y, z, w, h, d, actuation, ptype=1):
    if (ptype == 0):
        assert (actuation == (- 1))
    global n_particles
    density = 3
    w_count = int(((w / dx) * density))
    h_count = int(((h / dx) * density))
    d_count = int(((d / dx) * density))
    real_dx = (w / w_count)
    real_dy = (h / h_count)
    real_dz = (d / d_count)
    if (ptype == 1):
        for i in range(w_count):
            for j in range(h_count):
                for k in range(d_count):
                    self.x.append([((x + ((i + 0.5) * real_dx)) + self.offset_x), ((y + ((j + 0.5) * real_dy)) + self.offset_y), ((z + ((k + 0.5) * real_dz)) + self.offset_z)])
                    self.actuator_id.append(actuation)
                    self.particle_type.append(ptype)
                    self.n_particles += 1
                    self.n_solid_particles += int((ptype == 1))
                    if ((self.n_particles % 1000) == 0):
                        print('num particles', self.n_particles)
    else:
        for i in range(w_count):
            for j in range(h_count):
                for k in range(d_count):
                    self.x.append([((x + (random.random() * w)) + self.offset_x), ((y + (random.random() * h)) + self.offset_y), ((z + (random.random() * d)) + self.offset_z)])
                    self.actuator_id.append(actuation)
                    self.particle_type.append(ptype)
                    self.n_particles += 1
                    self.n_solid_particles += int((ptype == 1))
                    if ((self.n_particles % 1000) == 0):
                        print('num particles', self.n_particles)