You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Afternoon all,
I've been working this problem for 2 days now and not understanding the "why" it is happening.
Background: have a small object 3d model, looks great at a normal scale. The axes limits are x +/- 2, y +/- 2, y +/-4 with x at latitude, y as longitude, z as depth. 3d mesh is imported, rotated x 90deg. BUT lat/long moves are small in the 0.001 incremental range so it never looks like the model moves in the 3d graph. So, I want the plot scaling to be 0.002, 0.002, 4 (where lat/long = x/y, and depth is normal units
I've tried using the trimesh methods to rotate (works... found that out after I made my own rotate functions) and scale (works with 2,2,4 but not 0.002)
I've made my own scale function and it works as well
Is it a matter that 0.002 is too small a factor?
`
# 2,2,4 works, but need better fidelity of lat/long so need 0.002
#static.scale_factor = [2., 2., 4.]
static.scale_factor = [0.002, 0.002, 4.]
#loading the mesh, then scale and transform scale the Y as it is rotated 90 deg, rotation after
static.mesh = trimesh.load_mesh(path_mr)
static.mesh.apply_scale((static.scale_factor[0], static.scale_factor[2], static.scale_factor[1]))
static.vtx = [implot3d.Point(v[0], v[1], v[2]) for v in static.mr_mesh.vertices]
# this is another way to scale that works w/2,2,4 but not 0.002
#static.vtx = [implot3d.Point(v[0] * static.scale_factor[0], v[1] * static.scale_factor[2], v[2] * static.scale_factor[1]) for v in static.mesh.vertices]
static.vtx = rotate_pitch(static.vtx, 90) # current manta ray model is rotated 90
static.idx = static.mesh.faces.flatten().tolist()
static.mesh = implot3d.Mesh(static.vtx, static.idx)
...
# the start of begin_plot
if implot3d.begin_plot("##Mesh Plots", flags=plot_flags):
# Setup axis labels
implot3d.setup_axes("Lat", "Long", "Depth")
if static.change:
static.vtx = change_position(static.vtx, static.point)
static.mesh = implot3d.Mesh(static.vtx, static.idx)
static.change = False
implot3d.setup_axes_limits( static.point.x_lat - static.scale_factor[0], static.point.x_lat + static.scale_factor[0],
static.point.y_long - static.scale_factor[1], static.point.y_long + static.scale_factor[1],
static.depth - static.scale_factor[2], static.depth + static.scale_factor[2],
implot3d.Cond_.always)
def rotate_pitch(vertices, theta):
angle = math.radians(theta)
c, s = np.cos(angle), np.sin(angle)
rotation_matrix = np.array([
[1, 0, 0],
[0, c, -s],
[0, s, c]
])
# Apply rotation to each vertex
return [implot3d.Point(*(np.array([v.x, v.y, v.z]) @ rotation_matrix)) for v in vertices]
def change_scale(vertices, amount: list):
return [implot3d.Point(*(np.array([v.x * amount[0], v.y * amount[1], v.z * amount[2]]))) for v in vertices]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Afternoon all,
I've been working this problem for 2 days now and not understanding the "why" it is happening.
Background: have a small object 3d model, looks great at a normal scale. The axes limits are x +/- 2, y +/- 2, y +/-4 with x at latitude, y as longitude, z as depth. 3d mesh is imported, rotated x 90deg. BUT lat/long moves are small in the 0.001 incremental range so it never looks like the model moves in the 3d graph. So, I want the plot scaling to be 0.002, 0.002, 4 (where lat/long = x/y, and depth is normal units
I've tried using the trimesh methods to rotate (works... found that out after I made my own rotate functions) and scale (works with 2,2,4 but not 0.002)
I've made my own scale function and it works as well
Is it a matter that 0.002 is too small a factor?
`
# 2,2,4 works, but need better fidelity of lat/long so need 0.002
#static.scale_factor = [2., 2., 4.]
static.scale_factor = [0.002, 0.002, 4.]
`
All reactions