3d

Update Matplotlib 3D Graph Based on Real Time User Input

醉酒当歌 提交于 2020-01-05 05:45:09
问题 I am trying to get matplotlib to create a dynamic 3d graph based on user input - but I can't get the graph to update. If I use the exact same code but without the "projection='3d'" setting, the program works correctly - but as soon as the graph is changed to display in 3d - it doesn't work. Any help would be greatly appreciated. 3D Graph Code (graph doesn't update) import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider from mpl_toolkits.mplot3d import Axes3D

Can this mesh volume calculation algorithm handle imperfect meshes?

狂风中的少年 提交于 2020-01-05 05:44:07
问题 As per this answer, I read this research paper (very brief). To quote the answer: This all boils down to the following simple function: public float SignedVolumeOfTriangle(Vector p1, Vector p2, Vector p3) { var v321 = p3.X*p2.Y*p1.Z; var v231 = p2.X*p3.Y*p1.Z; var v312 = p3.X*p1.Y*p2.Z; var v132 = p1.X*p3.Y*p2.Z; var v213 = p2.X*p1.Y*p3.Z; var v123 = p1.X*p2.Y*p3.Z; return (1.0f/6.0f)*(-v321 + v231 + v312 - v132 - v213 + v123); } and then a driver to calculate the volume of the mesh: public

Translate Local quaternion rotation into global (gyro)

六眼飞鱼酱① 提交于 2020-01-05 05:00:12
问题 I need a way to get euler angles for rotation in global frame of reference from a local. I am using c#, wpf 3d and a gyroscope. I have a globe on the screen that should move in the same way as the gyro. Since the gyro sends movement relative to itself I need to use quaternions to keep the state of the object and update it but I'm stuck. If i do the following: var qu=eulerToQ(Gyro.X,Gyro.Y,Gyro.Z); GlobalQu = Quaternion.Multiply(qu, GlobalQu); IT rotates correctly on one axis. When I rotate by

How does this implementation of operator[] function work?

浪子不回头ぞ 提交于 2020-01-05 04:58:31
问题 I am working through a book (Foundations Of Game Engine Development By Eric Lengyel) and the book is writing out some vector operations in c++, here is the snippet: struct Vector3D { float x, y, z; Vector3D() = default; Vector3D(float a, float b, float c) { x = a; y = b; z = c; } float& operator [](int i) { return((&x)[i]); } }; im particularly concerned with this piece: float& operator [](int i) { return((&x)[i]); } Now I would expect this code to return x, no matter what index is entered.

.fbx Model grayed out can can't be edited

天涯浪子 提交于 2020-01-04 13:59:08
问题 I have models created with 3D Studio Max. When I save as .FBX and import into Unity 3D they become grey. What's the reason of this and how can i solve it? Also i have huge troubles with performance of model on mobile. What's the best approach to get app faster? 回答1: 1) all models gray- this means the texture was lost in the import. You can create materials and drag them onto the mesh. But Unity can import your max files directly, you dont have to export to .fbx. Maybe if you try that your

Will this cause gimbal-lock?

雨燕双飞 提交于 2020-01-04 13:39:00
问题 I making a very simple 3d scene, having 5 points in world coordinates. I'd like to navigate across the scene so I'm defining a camera with both an UP and OUT vector. With this information I generate a rotation matrix in every frame, which I'll apply to the vectors in order to get the camera coordinates. The question is: I've read about gimbal lock as a problem using this method, but would it happen in this case? Note that I'm generating the rotation matrix in every frame, and I'm not rotating

Will this cause gimbal-lock?

匆匆过客 提交于 2020-01-04 13:38:50
问题 I making a very simple 3d scene, having 5 points in world coordinates. I'd like to navigate across the scene so I'm defining a camera with both an UP and OUT vector. With this information I generate a rotation matrix in every frame, which I'll apply to the vectors in order to get the camera coordinates. The question is: I've read about gimbal lock as a problem using this method, but would it happen in this case? Note that I'm generating the rotation matrix in every frame, and I'm not rotating

Python Matplotlib 3D line appearing through surface

ε祈祈猫儿з 提交于 2020-01-04 09:03:37
问题 I am using a mapping to convert points on the surface of a cube to a sphere. I want to plot the surface of the resulting sphere and lines where the edges of the cube are mapped. So far, I have tried the following, working on one face of the cube at a time: import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def sphere_mapping(xbar,ybar,zbar): xx = xbar**2 yy = ybar**2 zz = zbar**2 x = xbar*np.sqrt(1 - yy/2 - zz/2 + yy*zz/3) y = ybar*np.sqrt(1 - xx/2 - zz

Is GLFW designed to use without LWJGL (in java)?

倾然丶 夕夏残阳落幕 提交于 2020-01-04 05:30:25
问题 I know LWJGL is just a wrapper for OpenGL. It's a java library designed to use the lower level OpenGL functions in the java language. As far as I understand now, GLFW is just a library which makes it possible to create better windows to display the graphics. So GLFW is just a library for creating windows in a better way than LWJGL did before. Is it true that GLFW is not for creating graphics, but just for creating displays? And GLFW is not for using alone, you still should just use the LWJGL

Java/LWJGL: Z axis in OpenGL behaving like left-handed coordinate system

只谈情不闲聊 提交于 2020-01-04 04:39:32
问题 Recently, I sought help regarding 3d camera rotations in OpenGL. This answer and the comments that followed helped me greatly, but there is still one major issue: when moving the camera, the motion is often, but not always, in exactly the opposite direction it should be. For instance, when the camera's orientation matrix is the identity, the camera moves perfectly. However, if it is rotated in any direction, its motion on the axis perpendicular to the axis of rotation will have the opposite