def transform_vector(self, vec, cur_pos): """ Transform vector to whatever coordinate system is used """ ret_vec = np.copy(vec) if Path.axis_config == Path.AXIS_CONFIG_H_BELT: X = np.dot(Path.matrix_H_inv, vec[0:2]) ret_vec[:2] = X[0] if Path.axis_config == Path.AXIS_CONFIG_CORE_XY: X = np.dot(Path.matrix_XY, vec[0:2]) ret_vec[:2] = X[0] if Path.axis_config == Path.AXIS_CONFIG_DELTA: # Subtract the current column positions if hasattr(self.prev, "end_ABC"): self.start_ABC = self.prev.end_ABC else: self.start_ABC = Delta.inverse_kinematics2(cur_pos[0], cur_pos[1], cur_pos[2]) # Find the next column positions self.end_ABC = Delta.inverse_kinematics2(cur_pos[0] + vec[0], cur_pos[1] + vec[1], cur_pos[2] + vec[2]) ret_vec[:3] = self.end_ABC - self.start_ABC # Apply Automatic bed compensation if self.use_bed_matrix: ret_vec[:3] = np.dot(Path.matrix_bed_comp, ret_vec[:3]) return ret_vec
def transform_vector(self, vec, cur_pos): """ Transform vector to whatever coordinate system is used """ ret_vec = np.copy(vec) if Path.axis_config == Path.AXIS_CONFIG_H_BELT: X = np.dot(Path.matrix_H_inv, vec[0:2]) ret_vec[:2] = X[0] if Path.axis_config == Path.AXIS_CONFIG_CORE_XY: X = np.dot(Path.matrix_XY, vec[0:2]) ret_vec[:2] = X[0] if Path.axis_config == Path.AXIS_CONFIG_DELTA: # Subtract the current column positions if hasattr(self.prev, "end_ABC"): self.start_ABC = self.prev.end_ABC else: self.start_ABC = Delta.inverse_kinematics2( cur_pos[0], cur_pos[1], cur_pos[2]) # Find the next column positions self.end_ABC = Delta.inverse_kinematics2(cur_pos[0] + vec[0], cur_pos[1] + vec[1], cur_pos[2] + vec[2]) ret_vec[:3] = self.end_ABC - self.start_ABC return ret_vec