surface

Fit a cylinder to scattered 3D XYZ point data

﹥>﹥吖頭↗ 提交于 2019-12-02 04:34:49
As in the title, I want to fit a cylinder to a group of 3D points with Python. This is a nice solution with MATLAB . How can we do it with Python? There is paper at David Eberly site "Fitting 3D Data with a Cylinder" that describes math basics and shows pseudocode. You can also refer to C++ code in Geometric Tools Engine at the same site. I think that some auxiliary math functions like matrix inverse etc could be implemented in NymPy. Using scipy.optimize.leastsq, we can create an error function in which the difference between the observed cylinder radius and the modelled radius is minimized.

Matlab - surf and contour3, clipping order?

那年仲夏 提交于 2019-12-02 01:29:25
I am plotting data as a surface in matlab. I have three data matrices, x,y,z. The values of z may not be outside the range 0~1. I generate plots with the following: surf(x,y,z); [c,h] = contour3(x,y,z,'LevelList',[0 : 0.1 : 1],'Color','k'); clabel(c,h,[0 : 0.1 : 1]); I also do some modifications to the surface, such as setting shading interp . As you can see, the result image clips the contours with the underlying surface. How can I ensure that the contour and labels are plotted above the surface? After some digging in the doc, I have found the best solution. The clipping order is specified at

“WPF老矣,尚能饭否”—且说说WPF今生未来(上):担心

夙愿已清 提交于 2019-12-02 00:33:03
近日微软公布了最新的WPF路线图,一片热议;对于老牌控件提供商葡萄城来说,这是WPF系列控件一个重要的机遇,因此,Spread Studio for WPF产品做了一次重要更新,并随着 Spread Studio 8.0发布 。鉴于此,选择翻译并整理了一篇自codeproject的文章:《 Is WPF dead: the present and future of WPF 》,抛砖引玉,且聊聊程序员心目中的WPF。 引子 作为一个老牌WPF程序员,多年来一直关注的问题是,在微软发布最新的WinRT框架之后,接下来的客户端编程将何去何从。 显然我有充分的理由担心这个,众所周知的Silverlight的中途搁浅,它对下游的开发人员带来了很大的损害;俗话说:一朝被蛇咬,十年怕井绳。这就是真实写照。 我从2009年开始就对WPF投入很大的精力,使用它开发财务相关的行业软件,如今,我依然还在这里,但是焦点转向了培训相关工作。作为专业开发和培训讲师,WPF的将来对我来说至关重要,这也是我深入思考这个问题的根结。 本文我将本着客观和透明的方式给大家分享我所的发现和感悟,希望起到抛砖引玉的作用,以此为社区提供更好的有前景的WPF。 另外,在本文的结尾,我将为企业和个人开发提供一些策略和个人见解。 有理由担心 首先,我将展示那些我所担心的标志性信号,如果你是一个WPF的利益相关者

Smooth cone normals

谁都会走 提交于 2019-12-01 13:27:28
I'm trying to calculate smooth normals for a cone. In looking around for code samples and explanations, I consistently come across directions for face normals. I've posted a couple pictures below of what I'm doing. The first -- which basically just normalizes the vertex position -- gives me decently smooth shading, but the edges are "missing" and the bottom face isn't solid. The second has edges, but the shading is flat (face normals) and my light isn't reflecting off of them correctly. The cone is built out of GL_TRIANGLES. Click the images for larger versions. (source: bantherewind.com )

r plotly 3d surface plot issue

妖精的绣舞 提交于 2019-12-01 06:48:13
I am trying to plot a 3d surface plot based on these plotly examples When I try these examples on my dataset test_plotly = structure(list(Age = c(82L, 82L, 83L, 83L, 83L, 81L, 81L, 81L, 79L, 80L, 82L, 78L, 78L, 79L, 78L, 80L, 79L, 77L, 77L, 77L, 77L, 78L, 76L, 77L, 77L, 78L, 77L, 76L, 83L, 79L, 76L, 84L, 75L, 75L, 77L, 74L, 74L, 75L, 74L, 74L, 73L, 73L, 74L, 81L, 84L, 73L, 72L, 73L, 71L, 71L, 73L, 72L, 79L, 72L, 71L, 76L, 72L, 75L, 73L, 71L, 70L, 79L, 69L, 70L, 70L, 70L, 77L, 69L, 69L, 68L, 69L, 73L, 69L, 69L, 74L, 68L, 69L, 70L, 74L, 68L, 68L, 68L, 68L, 68L, 68L, 80L, 69L, 72L, 80L, 80L, 81L,

Volume of a 3D closed mesh car object

巧了我就是萌 提交于 2019-12-01 05:55:35
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 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 outside. (Or all counter-clockwise, as long as it's consistent for all facets.) If the mesh has any

WPF老矣,尚能饭否——且说说WPF今生未来(中):策略

随声附和 提交于 2019-11-30 20:36:28
本文接上文《WPF老矣,尚能饭否——且说说WPF今生未来(上):担心》继续。 “上篇”中部分精彩的点评: 虽然WPF不再更新了,但是基于WPF的技术还是在发展着,就比如现在的WinRT,只不过API换了一套而已,xaml还是xaml,数据绑定还是数据绑定,依赖属性还是依赖属性,模板还是模板。其实学过WPF的转WinRT还是比较爽的,Blend的操作也没变,只不过现在WinRT的人才需求量的确有点坑。 最后感谢WPF给我们带来MVVM这种开发方式、开发模型。 by @ h82258652 虽然winfrom本身停止更新,但是工具却在一直升级啊!比如说VS设计器,C#语法,第三方控件和开源组件等等。 另外,WinForm基于Win32 api的设计本身就很成熟,从内容上来说基本上已经包罗万象,微软不更新也不会有问题。 by @ winkingzhang 技术总是要更新换代的,有些人说换个API来赚钱,倒也搞笑,映射出好多人换个API就不会开发了。我倒觉得,人家更新归更新,我们开发者做的其实永远就一件事情,写好我们的代码,做好的产品。.NET的代码永远也就那样写,对吧。 by @ 笋干 微软的新策略 在2014年二月,微软任命了一个新的CEO,他就是萨提亚·纳德拉,来自微软云服务部门。 他将接替上任史蒂芬·鲍尔默,就是那位不懂移动市场的(首先是iPhone和Android)

Display the maximum surface in matplotlib?

ぐ巨炮叔叔 提交于 2019-11-30 17:36:04
I'm plotting multiple surfaces on the same figure using matplotlib, and I'd like to see only the topmost surface, as matlab shows. Matlab 3D view: Matlab top view: Matplotlib 3D view: Matplotlib top view: How can I get Matplotlib to show a result similar to Matlab, in which whatever topmost class is shown at the top, as opposed to one single class taking precedence over the other? I was goign to think about some dirty hacks like mgab mentions in their answer, but then decided just to go a considerably simpler route: You can get a similar effect purely by using transparency, you just have to

Display the maximum surface in matplotlib?

瘦欲@ 提交于 2019-11-30 16:30:58
问题 I'm plotting multiple surfaces on the same figure using matplotlib, and I'd like to see only the topmost surface, as matlab shows. Matlab 3D view: Matlab top view: Matplotlib 3D view: Matplotlib top view: How can I get Matplotlib to show a result similar to Matlab, in which whatever topmost class is shown at the top, as opposed to one single class taking precedence over the other? 回答1: I was goign to think about some dirty hacks like mgab mentions in their answer, but then decided just to go

Mesh to mesh intersections

谁说胖子不能爱 提交于 2019-11-28 21:36:49
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. The way we usually do it using CGAL is with CGAL::box_intersection_d . You can make it by mixing this