def test_HomTra_is_close_to():
    t = rs.HomTra()
    assert t.is_close_to(t)

    u = rs.HomTra()
    assert t.is_close_to(u)
    u.set_translation([1.0, 2.0, 3.0])
    assert not t.is_close_to(u)
def test_HomTra_inverse_translation_x():
    t = rs.HomTra()
    t.set_translation([3, 0, 0])
    assert t.T[0,3] == 3.0
    assert t.T[1,3] == 0.0
    assert t.T[2,3] == 0.0

    t_inv = t.inverse()
    assert t_inv.T[0,3] == -3.0
    assert t_inv.T[1,3] == 0.0
    assert t_inv.T[2,3] == 0.0  

    assert t.is_close_to(t_inv.inverse())
def test_tait_bryan_eye():
    Rx = 0.0
    Ry = 0.0
    Rz = 0.0

    t = rs.HomTra()
    t.set_rotation_tait_bryan_angles(Rx, Ry, Rz)

    # rotation shall be eye3
    assert t.T[0,0] == 1.0
    assert t.T[0,1] == 0.0
    assert t.T[0,2] == 0.0

    assert t.T[1,0] == 0.0
    assert t.T[1,1] == 1.0
    assert t.T[1,2] == 0.0

    assert t.T[2,0] == 0.0
    assert t.T[2,1] == 0.0
    assert t.T[2,2] == 1.0
def test_HomTra_init():

    t = rs.HomTra()
    # translation shall be zero
    assert t.T[0,3] == 0.0
    assert t.T[1,3] == 0.0
    assert t.T[2,3] == 0.0

    # rotation shall be eye3
    assert t.T[0,0] == 1.0
    assert t.T[0,1] == 0.0
    assert t.T[0,2] == 0.0

    assert t.T[1,0] == 0.0
    assert t.T[1,1] == 1.0
    assert t.T[1,2] == 0.0

    assert t.T[2,0] == 0.0
    assert t.T[2,1] == 0.0
    assert t.T[2,2] == 1.0
def test_HomTra_all():
    t = rs.HomTra()
    t.set_rotation_axis_and_angle([0.0,0.0,1.0], np.rad2deg(90.0))
    t.set_translation([0.0, 1.0, 0.0])

    A = np.array([1.0, 0.0, 0.0])
    B = np.array([0.0, 1.0, 0.0])
    C = np.array([0.0, 0.0, 1.0])

    A_t = t.transformed_position(A)
    B_t = t.transformed_position(B)
    C_t = t.transformed_position(C)

    t_inv = t.inverse()

    assert np.isclose(t_inv.transformed_position(A_t), A, 1e-9).all()
    assert np.isclose(t_inv.transformed_position(B_t), B, 1e-9).all()
    assert np.isclose(t_inv.transformed_position(C_t), C, 1e-9).all()

    assert np.isclose(t.transformed_position_inverse(A), t.inverse().transformed_position(A), 1e-9).all()
    assert np.isclose(t.transformed_position_inverse(B), t.inverse().transformed_position(B), 1e-9).all()
    assert np.isclose(t.transformed_position_inverse(C), t.inverse().transformed_position(C), 1e-9).all()
예제 #6
0
"""
geometry = rs.Geometry(rs.config.example)
total_geometry = rs.factory.generate_reflector_with_tension_ring_and_cables(geometry)
nodes = total_geometry["nodes"]
bars_reflector = total_geometry["bars_reflector"]
bars_tension_ring = total_geometry["bars_tension_ring"]
cables = total_geometry["cables"]
elastic_supports = total_geometry["elastic_supports"]
cable_supports = total_geometry["cable_supports"]
mirror_tripods = total_geometry["mirror_tripods"]
fixtures = total_geometry["elastic_supports"]

"""
dish rotation
"""
homogenous_transformation = rs.HomTra()
homogenous_transformation.set_translation(geometry.translational_vector_xyz)
homogenous_transformation.set_rotation_tait_bryan_angles(geometry.tait_bryan_angle_Rx, geometry.tait_bryan_angle_Ry, geometry.tait_bryan_angle_Rz)
nodes_rotated = rs.SAP2000_bridge.HomTra_bridge_tools.get_nodes_moved_position(nodes, cable_supports, homogenous_transformation)

"""
initialize SAP2000 and make assigns
"""
structural = rs.SAP2000_bridge.Structural(rs.config.example)
bridge = rs.SAP2000_bridge.Bridge(structural)
#bridge._SapObject.Hide()
#bridge._SapObject.Unhide()

bridge.save_model_in_working_directory()
rs.SAP2000_bridge.TextFilesBridge.JointsCreate(nodes_rotated, structural)
rs.SAP2000_bridge.TextFilesBridge.FramesCreate(bars_reflector, bars_tension_ring, structural)