surface

matplotlib 3d surface plots not showing [duplicate]

不羁的心 提交于 2019-11-28 01:29:32
This question already has an answer here: surface plots in matplotlib 7 answers I am trying to make a simple 3D surface plot with matplotlib but the plot does not show at the end. I only get an empty 3D axes. Here is what I did from mpl_toolkits.mplot3d import Axes3D x= np.arange(1, 100, 1) y= np.arange(1, 100, 1) z= np.arange(1, 100, 1) fig= figure() ax= fig.add_subplot(111, projection ='3d') ax.plot_surface(x, y, z, rstride= 5, cstride= 5) show() So I get this Any suggestions? You are not plotting a surface: x , y and z needs to be 2D arrays. Look at this example: http://matplotlib.org

Mesh to mesh intersections

白昼怎懂夜的黑 提交于 2019-11-27 21:00:36
问题 I'm looking for a library or a paper that describes how to determine if one triangular mesh intersects another. Interestingly I am coming up empty. If there is some way to do it in CGAL, it is eluding me. It seems like it clearly should be possible, because triangle intersection is possible and because each mesh contains a finite number of triangles. But I assume there must be a better way to do it than the obvious O(n*m) approach where one mesh has n triangles and the other has m triangles.

How can I crop an image with Pygame?

为君一笑 提交于 2019-11-27 17:47:30
问题 I am learning pygame and want a graphic for a button with the three states: normal, hover, and pressed. I have an image like this one ... ... and I want to get a new Surface using a portion of it. I'm loading the image with this code: buttonStates = pygame.image.load(os.path.join('image','button.png')) How can I make a new surface using just a portion of that graphic? 回答1: cropped = pygame.Surface((80, 80)) cropped.blit(buttonStates, (0, 0), (30, 30, 80, 80)) The blit method on a surface

Plot surface from 3 1D arrays [duplicate]

断了今生、忘了曾经 提交于 2019-11-27 16:24:41
This question already has an answer here: surface plots in matplotlib 7 answers I wish to plot a surface using 3 1D arrays. To be more precise, I must plot the temperature along a rod over time. Is there a simple way to do this? Given arrays and their dimensions: T(n,1) temperature x(n,1) distance T(n,1) time What I basically aim to create is something like this: Thank you, for your answers.After a couple of hours i figured it out. I had to save all temperatures over time in another matrix, 'meshgrid' x and t (whatever that is...) et voila!. 来源: https://stackoverflow.com/questions/26074542

Run Pygame without a window / GUI

风格不统一 提交于 2019-11-27 06:52:28
问题 Is it possible to run pygame without creating a pygame window, surface or GUI? I want to utilize certain pygame functions, but I don't want a GUI popping up. For example, this function won't work unless I have set up a window within pygame. running = True def mainloop(): while True: for event in pygame.event.get(): if ( event.type == pygame.QUIT ) or \ ( event.type == pygame.KEYDOWN and \ ( event.key == pygame.K_ESCAPE) ): running = False print "quit" pygame.quit() if event.type == pygame

How to obtain 3D colored surface via Python?

不问归期 提交于 2019-11-26 23:28:54
问题 How to obtain the following surface via Matplotlib? It is easy in matlab via: mesh(peaks) It seems matplotlib does not have an exact counterpart of mesh in matlab. the Wireframe plots does not have any colormap option 回答1: It seems to be possible with matplotlib even if it is a bit of a hack: from mpl_toolkits.mplot3d import axes3d from mpl_toolkits.mplot3d import art3d import matplotlib.pyplot as plt import numpy as np import matplotlib as mpl fig = plt.figure() ax = fig.add_subplot(111,

Plot surface from 3 1D arrays [duplicate]

独自空忆成欢 提交于 2019-11-26 22:26:59
问题 This question already has an answer here: surface plots in matplotlib 7 answers I wish to plot a surface using 3 1D arrays. To be more precise, I must plot the temperature along a rod over time. Is there a simple way to do this? Given arrays and their dimensions: T(n,1) temperature x(n,1) distance T(n,1) time What I basically aim to create is something like this: 回答1: Thank you, for your answers.After a couple of hours i figured it out. I had to save all temperatures over time in another

matplotlib 3d surface plots not showing [duplicate]

邮差的信 提交于 2019-11-26 21:55:53
问题 This question already has an answer here: surface plots in matplotlib 7 answers I am trying to make a simple 3D surface plot with matplotlib but the plot does not show at the end. I only get an empty 3D axes. Here is what I did from mpl_toolkits.mplot3d import Axes3D x= np.arange(1, 100, 1) y= np.arange(1, 100, 1) z= np.arange(1, 100, 1) fig= figure() ax= fig.add_subplot(111, projection ='3d') ax.plot_surface(x, y, z, rstride= 5, cstride= 5) show() So I get this Any suggestions? 回答1: You are

MediaRecorder and VideoSource.SURFACE, stop failed: -1007 (a serious Android bug)

佐手、 提交于 2019-11-26 18:01:23
I'm trying to record MediaRecorder without using Camera instance but using Surface video source (yes it's possible, but it turned out that it's not that perfect) - mediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE); I just write what the issue: Next code works only on some devices and works temporary on some devices after a recent device rebooting or doesn't work at all If it doesn't work ok MediaRecorder.stop() method fails with the next error E/MediaRecorder: stop failed: -1007 W/System.err: java.lang.RuntimeException: stop failed. at android.media.MediaRecorder.stop(Native