3d

Why Z has to be 2-dimensional for 3d plotting in matplotlib

跟風遠走 提交于 2021-02-08 13:27:06
问题 I am trying to plot 3d Surface plots using code from this site using matplotlib: X,Y and Z are obtained as below: from math import pi from numpy import cos, meshgrid alpha = 0.7 phi_ext = 2 * pi * 0.5 def flux_qubit_potential(phi_m, phi_p): return 2 + alpha - 2 * cos(phi_p)*cos(phi_m) - alpha * cos(phi_ext - 2*phi_p) phi_m = linspace(0, 2*pi, 100) phi_p = linspace(0, 2*pi, 100) X,Y = meshgrid(phi_p, phi_m) Z = flux_qubit_potential(X, Y).T And 3d plotting is done with following code: from mpl

Cone rotation around apex with Cesium.js

旧城冷巷雨未停 提交于 2021-02-08 04:41:41
问题 I am trying to rotate a cone from its apex, rather than its centre, so that the apex remains in the same position. I've found the example below from the following link: https://groups.google.com/forum/#!topic/cesium-dev/f9ZiSWPMgus But it only shows how to rotate the cone by 90 degrees, if you choose a different value for roll, like 45 or 30 degrees, it gets skewed, and the apex ends up in the wrong place. I know its something to do with the offset, but can't make any progress from there. Is

Cone rotation around apex with Cesium.js

折月煮酒 提交于 2021-02-08 04:41:12
问题 I am trying to rotate a cone from its apex, rather than its centre, so that the apex remains in the same position. I've found the example below from the following link: https://groups.google.com/forum/#!topic/cesium-dev/f9ZiSWPMgus But it only shows how to rotate the cone by 90 degrees, if you choose a different value for roll, like 45 or 30 degrees, it gets skewed, and the apex ends up in the wrong place. I know its something to do with the offset, but can't make any progress from there. Is

Distance from a point to a line segment in 3d (Python)

拈花ヽ惹草 提交于 2021-02-08 03:31:31
问题 I am looking for Python function that would compute distance from a point in 3D (x_0,y_0,z_0) to a line segment defined by its endpoints (x_1,y_1,z_1) and (x_2,y_2,z_2). I have only found solution for 2D for this problem. There are solutions to finding a distance from a point to a line in 3d, but not to a line segment, like here: (picture taken from Calculate distance point to line segment with special cases) 回答1: This answer is adapted from here: Calculate the euclidian distance between an

Given a line in 3D space, how do I find the angle from it to a point?

穿精又带淫゛_ 提交于 2021-02-07 21:10:31
问题 I have two sets of points in 3D space. I'd like to draw a line that runs through the center of both sets of points, and then find the angle from that line to each point. From there, I'll match points in the two sets up based on how close together their two angles are. I know how to find the center of each set of points (just average them all together) and I know how to match them up (even accounting for the fact they'll wrap around), but I don't know how to find the angle from the line to the

Get only “valid” points in 2D interpolation of cloud point using Scipy/Numpy

大憨熊 提交于 2021-02-07 13:34:25
问题 I have a cloud point obtained from photogrammetry from a person's back. I'm trying to interpolate it to get a regular grid, and for that I'm using scipy.interpolate with good results so far. The problem is: the function I'm using ( scipy.interpolate.griddata ) uses the convex hull of the cloudpoint in the plane x,y, thus giving as result some values that don't exist in the original surface, which has a concave perimeter. The following illustration shows the original cloudpoint at the left

Get only “valid” points in 2D interpolation of cloud point using Scipy/Numpy

China☆狼群 提交于 2021-02-07 13:32:34
问题 I have a cloud point obtained from photogrammetry from a person's back. I'm trying to interpolate it to get a regular grid, and for that I'm using scipy.interpolate with good results so far. The problem is: the function I'm using ( scipy.interpolate.griddata ) uses the convex hull of the cloudpoint in the plane x,y, thus giving as result some values that don't exist in the original surface, which has a concave perimeter. The following illustration shows the original cloudpoint at the left

“Tube” Arrows in Python

老子叫甜甜 提交于 2021-02-07 10:58:27
问题 I am looking for a way to draw a few (O(1)) 3D arrows with python, which are "proper 3D", by which I mean something along the lines of what Mathematica yields, i.e. rod of the arrow looks like a tube. I did not find anything in the matplotlib documentation, but surely there must be a way? 回答1: You may create a solid of revolution from some path defined in 2D to create a 3D arrow. The following code wraps this into a function, which allows to specify some of the arrow parameters. This allows

Use FBX file with 3D model in iOS native app

馋奶兔 提交于 2021-02-07 10:06:09
问题 I have a requirement to display an interactive 3D model (the client supplies few FBX files) in one of the screens in a native Objective-C/Swift app. I know that there's a possibility to work with Unity/Cocos3D but then the entire app will have to be Unity/Cocos3D based. In my case the app has to be native and only one screen (one of the tabs in the tab bar controller) should integrate the 3D model that the user can move/rotate etc. Thanks. 回答1: The FBX SDK is available on iOS and I wrote a

An algorithm that automatically fits clothing?

拥有回忆 提交于 2021-02-07 04:12:16
问题 Imagine a client asked you to design a piece of software that would satisfy some pretty rough specs as follows: 1: it will be marketed towards the fashion industry 2: the users will be people that "design clothes and stuff" (there is likely a specific term for it but it doesn't come to mind) 3: For various reasons, it would be useful to be able to quickly prototype designs and see how they look on models. To make it more useful, it should be rendering 3D models so that the designers can look