- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我需要渲染一些从 (0,0,0) 开始并在球体上结束的 3D 向量。目前我用 python 和 matplotlib 做这个:
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import proj3d
from matplotlib.patches import FancyArrowPatch
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_aspect("equal")
# render the sphere mesh
u, v = np.mgrid[0:2*np.pi:20j, 00:np.pi:10j]
x=np.cos(u)*np.sin(v)
y=np.sin(u)*np.sin(v)
z=np.cos(v)
ax.plot_wireframe(x, y, z, color="r")
plt.axis('off')
class Arrow3D(FancyArrowPatch):
def __init__(self, xs, ys, zs, *args, **kwargs):
FancyArrowPatch.__init__(self, (0,0), (0,0), *args, **kwargs)
self._verts3d = xs, ys, zs
def draw(self, renderer):
xs3d, ys3d, zs3d = self._verts3d
xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
self.set_positions((xs[0],ys[0]),(xs[1],ys[1]))
FancyArrowPatch.draw(self, renderer)
gradients = [[ 0.57735027, -0.57735027, 0.57735027], [ 0.32103634, -0.15367924, -0.93451506], [ 0.41923004, -0.40336058, 0.81335509], [ 0.49175236, -0.7972576 , -0.35008559], [-0.77544582, -0.60942662, 0.16517574], [ 0.49080035, -0.37864643, -0.78469223], [-0.9688558 , -0.14921457, -0.19761968], [-0.55381966, -0.41340241, -0.72276008], [-0.51651138, -0.82581121, 0.22638878], [ 0.51285124, -0.09350922, 0.85336959], [-0.02404559, -0.99431705, -0.10370783], [-0.45752126, -0.15967038, 0.87474549], [-0.11906644, -0.66461051, 0.73764223], [-0.69553846, -0.26904184, 0.66621518], [ 0.84464198, -0.38759068, 0.3692607 ], [ 0.01218729, -0.86413401, 0.5031141 ], [-0.70542359, -0.10816363, -0.70048422], [-0.64579558, -0.75719821, -0.09797404], [ 0.22307518, -0.66173422, 0.715783 ], [ 0.35672677, -0.81123132, 0.46330312], [-0.64859039, -0.59819001, 0.47063699], [-0.9860335 , -0.04110239, 0.16139577], [ 0.78665483, -0.298026 , -0.54069835], [-0.22515292, -0.39356178, 0.89129978], [-0.03115982, -0.20828982, -0.97757065], [ 0.1714755 , -0.88971114, -0.42309603], [-0.1948448 , -0.48424336, -0.85296184], [-0.46394941, -0.51801461, 0.71861798], [-0.45273268, -0.81954175, -0.35126126], [-0.82887799, -0.29984823, -0.47228414], [ 0.21121763, -0.09845807, 0.97246754], [-0.11702234, -0.10076906, 0.98800373], [ 0.31119478, -0.68396461, -0.65981078], [ 0.65285712, -0.07680383, -0.75357729], [ 0.71209121, -0.26699486, 0.64933801], [ 0.97685069, -0.17835225, 0.11812361], [-0.34381351, -0.93718553, -0.05895334], [ 0.68615079, -0.67022949, 0.2828241 ], [-0.6588605 , -0.59295917, -0.46292791], [ 0.15754543, -0.46902952, -0.86901712], [ 0.89081973, -0.0551779 , 0.45099396], [ 0.09939465, -0.40802586, 0.90754372], [ 0.93604255, -0.26702261, -0.22917943], [-0.93707269, -0.34256476, 0.06741077], [-0.19623031, -0.95031369, 0.24165596], [ 0.45153776, -0.87650371, 0.16689767], [-0.0195914 , -0.72917062, -0.68405145], [ 0.65216494, -0.75583613, -0.05824633], [ 0.13336134, -0.97014433, 0.20257032], [ 0.86954373, -0.49204889, 0.04220884], [ 0.60317737, -0.57162017, -0.55626202], [-0.34353963, -0.78447777, 0.51630914], [-0.35424244, -0.68266952, -0.63912022], [-0.84101379, -0.50332689, -0.19838808], [-0.85885382, -0.33475134, 0.38770047], [ 0.30507854, -0.94518369, -0.11642545], [ 0.7822451 , -0.55481136, -0.28333196], [-0.15034926, -0.90096235, -0.4070158 ], [-0.37529847, -0.20644124, -0.90362221], [-0.87414831, -0.01486413, 0.48543158]]
for i in gradients:
ax.add_artist( Arrow3D([0,-i[0]],[0,-i[1]],[0,-i[2]], mutation_scale=20, lw=1, arrowstyle="-|>", color="k") )
ax.add_artist( Arrow3D([0,i[0]],[0,i[1]],[0,i[2]], mutation_scale=20, lw=1, arrowstyle="-|>", color="k") )
plt.show()
产生这样的图像:
但是,这非常糟糕,因为看不到空间深度。我怎样才能改善结果?
编辑:它们的结尾没有特殊意义,但图像的读者应该看到,这些方向几乎是均匀分布的。
最佳答案
当前渲染中明显缺乏深度主要是由于缺乏阴影。
matplotlib
未设置为处理“真正的”3D 渲染(即遮挡、阴影等),您将需要它提供的许多微妙的视觉提示获得深度的印象。
mayavi.mlab
是将简单的 python API 转换为功能非常全面的 3D 可视化包 (VTK) 的不错选择。
以您的例子为例:
import numpy as np
from mayavi import mlab
# render the sphere mesh
u, v = np.mgrid[0:2*np.pi:20j, 00:np.pi:10j]
x=np.cos(u)*np.sin(v)
y=np.sin(u)*np.sin(v)
z=np.cos(v)
for a,b,c in zip(x.T, y.T, z.T) + zip(x, y, z):
mlab.plot3d(a, b, c, color=(1,0,0), tube_radius=0.01)
gradients = np.array([[ 0.57735027, -0.57735027, 0.57735027], [ 0.32103634, -0.15367924, -0.93451506], [ 0.41923004, -0.40336058, 0.81335509], [ 0.49175236, -0.7972576 , -0.35008559], [-0.77544582, -0.60942662, 0.16517574], [ 0.49080035, -0.37864643, -0.78469223], [-0.9688558 , -0.14921457, -0.19761968], [-0.55381966, -0.41340241, -0.72276008], [-0.51651138, -0.82581121, 0.22638878], [ 0.51285124, -0.09350922, 0.85336959], [-0.02404559, -0.99431705, -0.10370783], [-0.45752126, -0.15967038, 0.87474549], [-0.11906644, -0.66461051, 0.73764223], [-0.69553846, -0.26904184, 0.66621518], [ 0.84464198, -0.38759068, 0.3692607 ], [ 0.01218729, -0.86413401, 0.5031141 ], [-0.70542359, -0.10816363, -0.70048422], [-0.64579558, -0.75719821, -0.09797404], [ 0.22307518, -0.66173422, 0.715783 ], [ 0.35672677, -0.81123132, 0.46330312], [-0.64859039, -0.59819001, 0.47063699], [-0.9860335 , -0.04110239, 0.16139577], [ 0.78665483, -0.298026 , -0.54069835], [-0.22515292, -0.39356178, 0.89129978], [-0.03115982, -0.20828982, -0.97757065], [ 0.1714755 , -0.88971114, -0.42309603], [-0.1948448 , -0.48424336, -0.85296184], [-0.46394941, -0.51801461, 0.71861798], [-0.45273268, -0.81954175, -0.35126126], [-0.82887799, -0.29984823, -0.47228414], [ 0.21121763, -0.09845807, 0.97246754], [-0.11702234, -0.10076906, 0.98800373], [ 0.31119478, -0.68396461, -0.65981078], [ 0.65285712, -0.07680383, -0.75357729], [ 0.71209121, -0.26699486, 0.64933801], [ 0.97685069, -0.17835225, 0.11812361], [-0.34381351, -0.93718553, -0.05895334], [ 0.68615079, -0.67022949, 0.2828241 ], [-0.6588605 , -0.59295917, -0.46292791], [ 0.15754543, -0.46902952, -0.86901712], [ 0.89081973, -0.0551779 , 0.45099396], [ 0.09939465, -0.40802586, 0.90754372], [ 0.93604255, -0.26702261, -0.22917943], [-0.93707269, -0.34256476, 0.06741077], [-0.19623031, -0.95031369, 0.24165596], [ 0.45153776, -0.87650371, 0.16689767], [-0.0195914 , -0.72917062, -0.68405145], [ 0.65216494, -0.75583613, -0.05824633], [ 0.13336134, -0.97014433, 0.20257032], [ 0.86954373, -0.49204889, 0.04220884], [ 0.60317737, -0.57162017, -0.55626202], [-0.34353963, -0.78447777, 0.51630914], [-0.35424244, -0.68266952, -0.63912022], [-0.84101379, -0.50332689, -0.19838808], [-0.85885382, -0.33475134, 0.38770047], [ 0.30507854, -0.94518369, -0.11642545], [ 0.7822451 , -0.55481136, -0.28333196], [-0.15034926, -0.90096235, -0.4070158 ], [-0.37529847, -0.20644124, -0.90362221], [-0.87414831, -0.01486413, 0.48543158]])
u, v, w = gradients.T
zero = np.zeros_like(u)
kwargs = dict(color=(.2,.2,.2), mode='arrow', resolution=20)
mlab.quiver3d(zero, zero, zero, u, v, w, **kwargs)
mlab.quiver3d(zero, zero, zero, -u, -v, -w, **kwargs)
mlab.show()
唯一的缺点是相对箭头是固定的(它们只是静态字形)。可能会改变它(即使用自定义字形),但我不知道如何随意。
您可以通过分别绘制箭头和主体来解决这个问题。渲染速度会很慢,但它说明了这个想法:
import numpy as np
from mayavi import mlab
# render the sphere mesh
u, v = np.mgrid[0:2*np.pi:20j, 00:np.pi:10j]
x=np.cos(u)*np.sin(v)
y=np.sin(u)*np.sin(v)
z=np.cos(v)
# White background and turn on antialiasing
fig = mlab.figure(bgcolor=(1,1,1))
fig.scene.render_window.aa_frames = 8
# Plot the sphere's mesh
for a,b,c in zip(x.T, y.T, z.T) + zip(x, y, z):
mlab.plot3d(a, b, c, color=(1,0,0), tube_radius=0.01)
gradients = np.array([[ 0.57735027, -0.57735027, 0.57735027], [ 0.32103634, -0.15367924, -0.93451506], [ 0.41923004, -0.40336058, 0.81335509], [ 0.49175236, -0.7972576 , -0.35008559], [-0.77544582, -0.60942662, 0.16517574], [ 0.49080035, -0.37864643, -0.78469223], [-0.9688558 , -0.14921457, -0.19761968], [-0.55381966, -0.41340241, -0.72276008], [-0.51651138, -0.82581121, 0.22638878], [ 0.51285124, -0.09350922, 0.85336959], [-0.02404559, -0.99431705, -0.10370783], [-0.45752126, -0.15967038, 0.87474549], [-0.11906644, -0.66461051, 0.73764223], [-0.69553846, -0.26904184, 0.66621518], [ 0.84464198, -0.38759068, 0.3692607 ], [ 0.01218729, -0.86413401, 0.5031141 ], [-0.70542359, -0.10816363, -0.70048422], [-0.64579558, -0.75719821, -0.09797404], [ 0.22307518, -0.66173422, 0.715783 ], [ 0.35672677, -0.81123132, 0.46330312], [-0.64859039, -0.59819001, 0.47063699], [-0.9860335 , -0.04110239, 0.16139577], [ 0.78665483, -0.298026 , -0.54069835], [-0.22515292, -0.39356178, 0.89129978], [-0.03115982, -0.20828982, -0.97757065], [ 0.1714755 , -0.88971114, -0.42309603], [-0.1948448 , -0.48424336, -0.85296184], [-0.46394941, -0.51801461, 0.71861798], [-0.45273268, -0.81954175, -0.35126126], [-0.82887799, -0.29984823, -0.47228414], [ 0.21121763, -0.09845807, 0.97246754], [-0.11702234, -0.10076906, 0.98800373], [ 0.31119478, -0.68396461, -0.65981078], [ 0.65285712, -0.07680383, -0.75357729], [ 0.71209121, -0.26699486, 0.64933801], [ 0.97685069, -0.17835225, 0.11812361], [-0.34381351, -0.93718553, -0.05895334], [ 0.68615079, -0.67022949, 0.2828241 ], [-0.6588605 , -0.59295917, -0.46292791], [ 0.15754543, -0.46902952, -0.86901712], [ 0.89081973, -0.0551779 , 0.45099396], [ 0.09939465, -0.40802586, 0.90754372], [ 0.93604255, -0.26702261, -0.22917943], [-0.93707269, -0.34256476, 0.06741077], [-0.19623031, -0.95031369, 0.24165596], [ 0.45153776, -0.87650371, 0.16689767], [-0.0195914 , -0.72917062, -0.68405145], [ 0.65216494, -0.75583613, -0.05824633], [ 0.13336134, -0.97014433, 0.20257032], [ 0.86954373, -0.49204889, 0.04220884], [ 0.60317737, -0.57162017, -0.55626202], [-0.34353963, -0.78447777, 0.51630914], [-0.35424244, -0.68266952, -0.63912022], [-0.84101379, -0.50332689, -0.19838808], [-0.85885382, -0.33475134, 0.38770047], [ 0.30507854, -0.94518369, -0.11642545], [ 0.7822451 , -0.55481136, -0.28333196], [-0.15034926, -0.90096235, -0.4070158 ], [-0.37529847, -0.20644124, -0.90362221], [-0.87414831, -0.01486413, 0.48543158]])
u, v, w = gradients.T
zero = np.zeros_like(u)
color = (0.2, 0.2, 0.2)
head_length = 0.2
for direct in [-1, 1]:
h, b = direct * 0.2, direct * (1 - head_length)
mlab.quiver3d(b*u, b*v, b*w, h*u, h*v, h*w,
mode='cone', scale_factor=1, color=color, resolution=20)
for i, j, k in zip(u, v, w):
mlab.plot3d([0, b*i], [0, b*j], [0, b*k], color=color, tube_radius=0.01)
mlab.show()
你也可以改变一些东西,让圆锥体在球体的外面:
更进一步,您可以通过以下方式稍微提高渲染速度并获得不那么困惑的图形:
import numpy as np
from mayavi import mlab
# White background and turn on antialiasing
fig = mlab.figure(bgcolor=(1,1,1))
fig.scene.render_window.aa_frames = 8
# Sphere at origin with a diameter of 2 (radius of 1)
ltgray = (0.9, 0.9, 0.9)
mlab.points3d([0], [0], [0], [2], resolution=20, scale_factor=1, color=ltgray)
gradients = np.array([[ 0.57735027, -0.57735027, 0.57735027], [ 0.32103634, -0.15367924, -0.93451506], [ 0.41923004, -0.40336058, 0.81335509], [ 0.49175236, -0.7972576 , -0.35008559], [-0.77544582, -0.60942662, 0.16517574], [ 0.49080035, -0.37864643, -0.78469223], [-0.9688558 , -0.14921457, -0.19761968], [-0.55381966, -0.41340241, -0.72276008], [-0.51651138, -0.82581121, 0.22638878], [ 0.51285124, -0.09350922, 0.85336959], [-0.02404559, -0.99431705, -0.10370783], [-0.45752126, -0.15967038, 0.87474549], [-0.11906644, -0.66461051, 0.73764223], [-0.69553846, -0.26904184, 0.66621518], [ 0.84464198, -0.38759068, 0.3692607 ], [ 0.01218729, -0.86413401, 0.5031141 ], [-0.70542359, -0.10816363, -0.70048422], [-0.64579558, -0.75719821, -0.09797404], [ 0.22307518, -0.66173422, 0.715783 ], [ 0.35672677, -0.81123132, 0.46330312], [-0.64859039, -0.59819001, 0.47063699], [-0.9860335 , -0.04110239, 0.16139577], [ 0.78665483, -0.298026 , -0.54069835], [-0.22515292, -0.39356178, 0.89129978], [-0.03115982, -0.20828982, -0.97757065], [ 0.1714755 , -0.88971114, -0.42309603], [-0.1948448 , -0.48424336, -0.85296184], [-0.46394941, -0.51801461, 0.71861798], [-0.45273268, -0.81954175, -0.35126126], [-0.82887799, -0.29984823, -0.47228414], [ 0.21121763, -0.09845807, 0.97246754], [-0.11702234, -0.10076906, 0.98800373], [ 0.31119478, -0.68396461, -0.65981078], [ 0.65285712, -0.07680383, -0.75357729], [ 0.71209121, -0.26699486, 0.64933801], [ 0.97685069, -0.17835225, 0.11812361], [-0.34381351, -0.93718553, -0.05895334], [ 0.68615079, -0.67022949, 0.2828241 ], [-0.6588605 , -0.59295917, -0.46292791], [ 0.15754543, -0.46902952, -0.86901712], [ 0.89081973, -0.0551779 , 0.45099396], [ 0.09939465, -0.40802586, 0.90754372], [ 0.93604255, -0.26702261, -0.22917943], [-0.93707269, -0.34256476, 0.06741077], [-0.19623031, -0.95031369, 0.24165596], [ 0.45153776, -0.87650371, 0.16689767], [-0.0195914 , -0.72917062, -0.68405145], [ 0.65216494, -0.75583613, -0.05824633], [ 0.13336134, -0.97014433, 0.20257032], [ 0.86954373, -0.49204889, 0.04220884], [ 0.60317737, -0.57162017, -0.55626202], [-0.34353963, -0.78447777, 0.51630914], [-0.35424244, -0.68266952, -0.63912022], [-0.84101379, -0.50332689, -0.19838808], [-0.85885382, -0.33475134, 0.38770047], [ 0.30507854, -0.94518369, -0.11642545], [ 0.7822451 , -0.55481136, -0.28333196], [-0.15034926, -0.90096235, -0.4070158 ], [-0.37529847, -0.20644124, -0.90362221], [-0.87414831, -0.01486413, 0.48543158]])
u, v, w = gradients.T
# Put cones on the outside of the sphere
for direct in [-1, 1]:
h = direct * 0.2 # Head length
mlab.quiver3d(direct*u, direct*v, direct*w, h*u, h*v, h*w, color=(.2,.2,.2),
mode='cone', scale_factor=1, resolution=20)
mlab.show()
你也可以让球体稍微大一点作为软糖因素来绕过不完全与某些锥体底部相交的平面(例如 points3d([0],[0],[0],[2.05 ],...)
):
另一种展示方式是立体声网络。立体图有点模糊,但它们是使用 2D 图显示 3D 方向分布的一种非常好的方式。
import numpy as np
import matplotlib.pyplot as plt
import mplstereonet
gradients = np.array([[ 0.57735027, -0.57735027, 0.57735027], [ 0.32103634, -0.15367924, -0.93451506], [ 0.41923004, -0.40336058, 0.81335509], [ 0.49175236, -0.7972576 , -0.35008559], [-0.77544582, -0.60942662, 0.16517574], [ 0.49080035, -0.37864643, -0.78469223], [-0.9688558 , -0.14921457, -0.19761968], [-0.55381966, -0.41340241, -0.72276008], [-0.51651138, -0.82581121, 0.22638878], [ 0.51285124, -0.09350922, 0.85336959], [-0.02404559, -0.99431705, -0.10370783], [-0.45752126, -0.15967038, 0.87474549], [-0.11906644, -0.66461051, 0.73764223], [-0.69553846, -0.26904184, 0.66621518], [ 0.84464198, -0.38759068, 0.3692607 ], [ 0.01218729, -0.86413401, 0.5031141 ], [-0.70542359, -0.10816363, -0.70048422], [-0.64579558, -0.75719821, -0.09797404], [ 0.22307518, -0.66173422, 0.715783 ], [ 0.35672677, -0.81123132, 0.46330312], [-0.64859039, -0.59819001, 0.47063699], [-0.9860335 , -0.04110239, 0.16139577], [ 0.78665483, -0.298026 , -0.54069835], [-0.22515292, -0.39356178, 0.89129978], [-0.03115982, -0.20828982, -0.97757065], [ 0.1714755 , -0.88971114, -0.42309603], [-0.1948448 , -0.48424336, -0.85296184], [-0.46394941, -0.51801461, 0.71861798], [-0.45273268, -0.81954175, -0.35126126], [-0.82887799, -0.29984823, -0.47228414], [ 0.21121763, -0.09845807, 0.97246754], [-0.11702234, -0.10076906, 0.98800373], [ 0.31119478, -0.68396461, -0.65981078], [ 0.65285712, -0.07680383, -0.75357729], [ 0.71209121, -0.26699486, 0.64933801], [ 0.97685069, -0.17835225, 0.11812361], [-0.34381351, -0.93718553, -0.05895334], [ 0.68615079, -0.67022949, 0.2828241 ], [-0.6588605 , -0.59295917, -0.46292791], [ 0.15754543, -0.46902952, -0.86901712], [ 0.89081973, -0.0551779 , 0.45099396], [ 0.09939465, -0.40802586, 0.90754372], [ 0.93604255, -0.26702261, -0.22917943], [-0.93707269, -0.34256476, 0.06741077], [-0.19623031, -0.95031369, 0.24165596], [ 0.45153776, -0.87650371, 0.16689767], [-0.0195914 , -0.72917062, -0.68405145], [ 0.65216494, -0.75583613, -0.05824633], [ 0.13336134, -0.97014433, 0.20257032], [ 0.86954373, -0.49204889, 0.04220884], [ 0.60317737, -0.57162017, -0.55626202], [-0.34353963, -0.78447777, 0.51630914], [-0.35424244, -0.68266952, -0.63912022], [-0.84101379, -0.50332689, -0.19838808], [-0.85885382, -0.33475134, 0.38770047], [ 0.30507854, -0.94518369, -0.11642545], [ 0.7822451 , -0.55481136, -0.28333196], [-0.15034926, -0.90096235, -0.4070158 ], [-0.37529847, -0.20644124, -0.90362221], [-0.87414831, -0.01486413, 0.48543158]])
x, y, z = gradients.T
fig, ax = mplstereonet.subplots(projection='equal_area')
ax.grid(True)
ax.pole(*mplstereonet.vector2pole(x,y,z))
plt.show()
关于python - 在球体中渲染矢量,具有更好的感知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22436968/
我一直在尝试根据内部“ Shiny 球体”图案在球体上产生发光效果,但一直坚持定位“球体”的某些方面。 就目前而言,我的 CSS 看起来像这样: .sphere { height: 200px;
我正在尝试使用下面给出的旋转矩阵来旋转“轨道”: [cos(angle) -sin(angle) 0; sin(angle) cos (angle) 0; 0 0
我有一组由地理 (WGS84) 坐标指定的多边形:它们位于一个球体上。 我有一个由经纬度对指定的点。 我想(有效地)找到点和多边形之间的最小大圆距离。 我当前的堆栈包括 fiona、shapely、g
将 boost::geometry::line_interpolate 与 boost::geometry::srs::spheroid 结合使用,我正在计算沿最短距离的大圆导航点2个地理点。下面的代
如何在 JavaFX 中填充具有线性渐变(如 2d 圆)的 3D 球体?我使用 JavaFX Scene Builder。 最佳答案 正如@mohsenmadi 所指出的,漫反射颜色不允许您使用一种颜
我想使用 Python PyOpenGL 生成三个球体的场景。两个在有颜色的一侧(红色和绿色)。中间一个上面有任何纹理(砖 block 纹理实际上是与代码位于同一目录中的方形 jpg 文件)。 到目前
我从不同网格变量中的 .x 文件加载多个网格。现在我想计算我加载的所有网格(以及正在显示的网格)的包围球请指导我如何实现这一目标。可以将 VertexBuffers 附加到一个变量中并使用它计算 bo
我正在尝试用“粒子”(由 3D XYZ 向量表示)以最佳方式填充 3D 球形体积,这些粒子需要彼此保持特定距离,同时尽量减少它们之间存在的自由空间量. 但有一个问题 - 粒子本身可能会落在球形体积的边
我想创建一个球体,实际上是一个地球仪。但我似乎找不到任何有关如何处理球体的顶点和索引以及如何设置它们的有用信息。你们中的任何人都可以引导我走上正确的轨道,也许给我一些示例代码或指向教程的链接吗? 最佳
我终于手动画了一个球体:) 我希望我的球体是红色的,但轮廓是绿色的: 为了实现这一点,我做了以下事情。我用红色画了一个实心球体,然后我画了同一个球体,但线框和绿色。当我打开 DEPTH_TEST 时,
我想在 HTML 5.0 Canvas 中绘制 3D 球或球体。我想了解有关如何绘制 3D 球体的算法。谁可以与我分享这个? 最佳答案 您将需要为一个球体建模,并让它具有不同的颜色,以便在它旋转时您可
我正在尝试使用 webGL 构建 3D 太阳系。 我让所有恒星按照应有的方式绕太阳旋转,并且我希望它们也绕自己的 Y 轴旋转。 我怎样才能添加它?我尝试过: mat4.rotate(mvMatrix,
我有二维彩色图像。所有彩色点都位于此矩形图像中心的圆形区域内,圆圈外的所有点都是黑色的(我从鱼眼相机获得这些矩形图像)。我知道这个圆心的坐标和它的半径。 我需要将所有彩色点从 2D 图像上的圆形区域移
我正在用球体上的粒子进行 Metropolis Monte Carlo 模拟,并有一个关于给定时间步长内随机运动的问题。 我知道要在球体上获得均匀分布的随机点开始,使用最简单的方法是不够的(使用恒定
我想让球体向前移动一定的厘米,但到目前为止我还没有设法让任何东西正常工作这是我现在的代码: EditText distanceText = (EditText) findViewById(R.id.d
我想仅使用 Canvas 制作一个旋转对象(球体、盒子等)。但我找不到教程。如果您看到某个地方或解释如何做,请提供帮助。 像这样example ,仅无任何效果 最佳答案 希望你喜欢数学。如果您愿意编写
使用 GL_TRIANGLES 在 OpenGL ES 2.0 中绘制纹理球体的最简单方法是什么? 我特别想知道如何计算顶点。 最佳答案 有多种方法可以对球体进行三角测量。受欢迎的,不太受欢迎的,好的
我有一个关于在 HTML5/Canvas/Javascript 中伪造 3d 的问题... 基本上,我在 上绘制了一个二维图像使用 drawImage() . 我想做的是绘制图像,然后置换球体上的纹
我在 OpenGL ES 中绘制行星,遇到了一些有趣的性能问题。普遍的问题是:如何最好地在球体上渲染“非常详细”的纹理? (球体是有保证的;我对球体特定的优化很感兴趣) 基本案例: 窗口大约是。 20
对于我的论文项目,我使用 DataArts WebGL Globe 来开发一个网页,该网页将在触摸显示器上的展览中使用。作为监视器触摸,我需要使地球可点击以选择单个国家并打开弹出窗口并突出显示选定的国
我是一名优秀的程序员,十分优秀!