surface

How to plot a slicing plane with a surface with “matplotlib” in python

回眸只為那壹抹淺笑 提交于 2020-04-18 02:54:09
问题 I wonder how to create two slicing planes with a surface to two 2d figures. For example, I created a surface as below: from mpl_toolkits.mplot3d import Axes3D from matplotlib import pyplot as plt import numpy as np def f(x1, x2): return 0.5 * x1 + 0.6 * x2 + 0.2 * x1 * x1 + 0.1 * x1 * x2 + 0.3 * x2 * x2 + 4 x = np.linspace(-3, 3, 100) y = np.linspace(-3, 3, 100) xx, yy = np.meshgrid(x,y) z = f(xx, yy) # set up the figure fig = plt.figure() ax = fig.gca(projection='3d') ax.set_xlim(-3, 3) ax

HFSS——平面正弦加载阿基米德螺旋线模型设计

怎甘沉沦 提交于 2020-04-07 08:53:43
  这学期开始进入HFSS的学习,这是软件应该是电磁相关专业必须掌握的软件之一。前几天图老师发布第一个模型设计任务,是关于平面正弦加载阿基米德螺旋线,拿到具体要求后,就去网上找资料,发现有关HFSS的资料其实挺少的,而且有不少人都有相似的疑问,并且没有给出详细的解决方法。下面是我在对平面正弦加载阿基米德螺旋线模型设计的具体步骤。 首先是老师的给设计内容,其实比较简单,就曲线函数的解决和完成后的模型图 分析曲线函数各参数的作用 通过曲线函数得x与y的坐标 x=(a+b*(Θ+c*sin(Θ*D)))cosΘ y=(a+b*(Θ+c*sin(Θ*D)))sinΘ 对于函数参数的主要讲解c和d。 一下对比都是采取控制变量法 c是正弦线的幅度,决定最高值和最小值的大小。c的数值不宜太多,否则出来的图像就不想正弦波。 对于D则是加载正弦波的周期,我理解为单位时间内周期的数次。数值越大,出现的周期则越密集。具体的数值更具需要调整 以下是我的具体的参数数据 第一步已经完成,出现了正弦加载阿基米德螺旋线,接下来就是将线改成平面,我在这一步卡了很久,教材没有找到怎么改线宽,去问老师,老师说要改线宽,使其变成面,但是一直没有找到在哪里改,后面通过网友帮忙,发现可能是版本太老的原因吧,HFSS13.0版找不到修改线宽的地方,15.0和19.0版本都有,也有可能是不知道被藏在某个角落没有被我找到

pygame 游戏开发

孤街醉人 提交于 2020-04-06 10:02:47
简单的战旗游戏开发学习 在网上找寻教程之后搞出了这么个雏形 游戏介绍 游戏实现了战斗场景的回合制玩法: 对战双方每个生物每一轮有一次行动机会,可以行走或攻击对方。 每个生物属性有:行走范围,速度,生命,伤害,防御,攻击 和 是否是远程兵种。 当把对方生物都消灭时,即胜利。 代码介绍 对于战旗类游戏的核心还是地图,虽然网上有六边形的地图教程但是没看太懂就做正方形的吧 首先定义函数,width 和 height 为地图的宽度和长度,bg_map 设置方格的背景颜色, entity_map 保存哪个方格上有生物。active_entity表示当前要行动的生物。 class Map(): def __init__(self, width, height, grid): self.width = width self.height = height self.bg_map = [[0 for x in range(self.width)] for y in range(self.height)] self.entity_map = [[None for x in range(self.width)] for y in range(self.height)] self.active_entity = None self.select = None self.setupMapImage(grid

在线笔记也可以人工智能

泄露秘密 提交于 2020-03-26 11:28:03
3 月,跳不动了?>>> 在线笔记 Notebook 迎来了全新的升级,现在拥有的非常智能的 Zia 功能可以自动检测拼写和语法的错误,从此无需再担心文本出错; 很多人喜欢随手画些草稿,Notebook 在Windows,Linux 和Web网页端现都支持草图功能,并且还与Zoho Connect和Google Drive做了高效的集成。 https://www.zoho.com.cn/notebook/ 新功能 流畅的文本 Notebook是第一款可以自动检查拼写及语法问题的笔记软件,Zia通过先进的机器学习,可以分析你的书写逻辑及词语组合,检测错误;并且支持80多种语言,目前只有在Web端可以使用Zia的自动检测功能,其他平台将陆续开放。 便捷的绘图 现在可以在多个平台上使用Notebook绘制草图,如Web,Windows和Linux。如果使用的是Surface,可以使用Surface Pen来绘制草稿。 高效的集成 Notebook与Zoho Connect 在新的集成中,可以在Zoho Connect里与同事共享你的Notebook中的笔记内容,并在团队中与同事发起对话,实时交流。 Notebook与Google Drive 把使用的文件存储在同一个地方更方便管理,现在支持同步Notebook中的重要文件到Google Drive中。 除了以上的精彩升级外

python2048游戏

余生长醉 提交于 2020-03-13 21:00:54
运行结果: 参考代码: import random import sys import pygame from pygame.locals import * PIXEL = 150 SCORE_PIXEL = 100 SIZE = 4 # 地图的类 class Map: def __init__(self, size): self.size = size self.score = 0 self.map = [[0 for i in range(size)] for i in range(size)] self.add() self.add() # 新增2或4,有1/4概率 def add(self): while True: p = random.randint(0, self.size * self.size - 1) if self.map[p // self.size][p % self.size] == 0: x = (random.randint(0, 3) > 0 and 2) or 4 self.map[p // self.size][p % self.size] = x self.score += x break # 地图向左靠拢,其他方向的靠拢可以通过适当旋转实现,返回地图是否更新 def adjust(self): changed = False for a

吐槽一下 Surface 的扩展坞

浪子不回头ぞ 提交于 2020-02-29 10:47:22
  UMU 买了 Surface Pro 3 和 Surface Pro 4 的扩展坞各一个,在公司和家里混用时就发现了一个不太妙的情况:两个不同的扩展坞,理论上他们的网卡也应该是不同的,实际测试 MAC 地址确实也是不同的,然后实际上它们在 Windows 里都被映射为一个叫 Surface Ethernet Adapter 的网卡,是一个,是一个,是一个!!!   这样的机制感觉挺不合理的,比如公司的网络是绑定固定的 IP-MAC 地址的,家里是 DHCP 的,结果要反复修改 IP,虽然稣写了一个自动修改 IP 的脚本,但如果两个扩展坞是映射为两张不同的网卡,问题不就不存在了吗?   难道要把家里的路由器改成和公司一样的网段?蛋疼啊! 来源: oschina 链接: https://my.oschina.net/u/725292/blog/546767

Plotly Plot surface 3D not displayed

萝らか妹 提交于 2020-02-24 09:27:05
问题 I really can't find an answer on the forum. I want to create a 3d surface with plotly offline. I use sample points. The scene displays empty without a surface. Please help, thanks. import pandas as pd import numpy as np from plotly.offline import download_plotlyjs, init_notebook_mode, plot from plotly.graph_objs import * init_notebook_mode() df3=pd.DataFrame({'x':[1,2,3,4,5], 'y':[10,20,30,20,10], 'z':[5,4,3,2,1]}) trace0= Surface(x=df3['x'], y=df3['y'], z=df3['z']) data=[trace0] fig=dict

Detect MS Surface Virtual Keyboard in Javascript

≯℡__Kan透↙ 提交于 2020-01-23 09:07:27
问题 Is there a way to detect when the virtual keyboard of the MS Surface is being displayed in a web page via Javascript. The virtual keyboard is covering up the active text field on a page, and I need to be able to detect this so that I can re-layout the page to work better with the remaining window area. 来源: https://stackoverflow.com/questions/29997889/detect-ms-surface-virtual-keyboard-in-javascript

Pygame. How do I resize a surface and keep all objects within proportionate to the new window size?

一笑奈何 提交于 2020-01-23 08:07:28
问题 If I set a pygame window to resizable and then click and drag on the border of the window the window will get larger but nothing blit onto the surface will get larger with it. (Which is understandable) How would I make it so that when I resize a window all blit objects resize with it and fill the window properly? For example: Say I have a window of 200 x 200 and I blit a button at window_width/2 and window_height/2. The button would be in the center of the window at 100 x 100. Now if I resize

Volume of a 3D closed mesh car object

时光怂恿深爱的人放手 提交于 2020-01-21 07:16:12
问题 I have a 3D closed mesh car object having a surface made up triangles. I want to calculate its volume, center of volume and inertia tensor. Could you help me Regards. George 回答1: For volume... For each triangular facet, lookup its corner points. Call 'em P,Q,R. Compute this quantity (I call it "partial volume") pv = PxQyRz + PyQzRx + PzQxRy - PxQzRy - PyQxRz - PzQyRx Add these together for all facets and divide by 6. Important! The P,Q,R for each facet must be arranged clockwise as seen from