geometry

Algorithm for a geodesic sphere

南笙酒味 提交于 2021-02-06 05:39:55
问题 I have to make a sphere out of smaller uniformely distributed balls. I think the optimal way is to build a triangle-based geodesic sphere and use the vertices as the middle points of my balls. But I fail to write an algorithm generating the vertices. Answer in C++ or pseudo-code will be better. Example of a geodesic sphere: http://i.stack.imgur.com/iNQfP.png 回答1: Using the link @Muckle_ewe gave me, I was able to code the following algorithm: Outside the main() class Vector3d { // this is a

Algorithm for a geodesic sphere

风格不统一 提交于 2021-02-06 05:38:09
问题 I have to make a sphere out of smaller uniformely distributed balls. I think the optimal way is to build a triangle-based geodesic sphere and use the vertices as the middle points of my balls. But I fail to write an algorithm generating the vertices. Answer in C++ or pseudo-code will be better. Example of a geodesic sphere: http://i.stack.imgur.com/iNQfP.png 回答1: Using the link @Muckle_ewe gave me, I was able to code the following algorithm: Outside the main() class Vector3d { // this is a

Algorithm for a geodesic sphere

↘锁芯ラ 提交于 2021-02-06 05:36:06
问题 I have to make a sphere out of smaller uniformely distributed balls. I think the optimal way is to build a triangle-based geodesic sphere and use the vertices as the middle points of my balls. But I fail to write an algorithm generating the vertices. Answer in C++ or pseudo-code will be better. Example of a geodesic sphere: http://i.stack.imgur.com/iNQfP.png 回答1: Using the link @Muckle_ewe gave me, I was able to code the following algorithm: Outside the main() class Vector3d { // this is a

Polygon infill algorithm

不羁岁月 提交于 2021-02-05 20:36:24
问题 I'm working on mesh slicing utility for 3d printing purposes. In general it should slice a 3d mesh model into 2d shapes (a number of polygons, probably with holes) and fill them with paths of determined thickness using a specific pattern. These paths will be used to generate a gcode commands for a 3d printer firmware. There are various open source tools with same purposes, written on python and perl. But my goal is to understand the workflow of slicer and to write my own tool in C or C++. So

Minimum number of rectangles in shape made from rectangles?

浪尽此生 提交于 2021-02-05 18:54:51
问题 I'm not sure if there's an algorithm that can solve this. A given number of rectangles are placed side by side horizontally from left to right to form a shape. You are given the width and height of each. How would you determine the minimum number of rectangles needed to cover the whole shape? i.e How would you redraw this shape using as few rectangles as possible? I've can only think about trying to squeeze as many big rectangles as i can but that seems inefficient. Any ideas? Edit: You are

Minimum number of rectangles in shape made from rectangles?

穿精又带淫゛_ 提交于 2021-02-05 18:54:46
问题 I'm not sure if there's an algorithm that can solve this. A given number of rectangles are placed side by side horizontally from left to right to form a shape. You are given the width and height of each. How would you determine the minimum number of rectangles needed to cover the whole shape? i.e How would you redraw this shape using as few rectangles as possible? I've can only think about trying to squeeze as many big rectangles as i can but that seems inefficient. Any ideas? Edit: You are

Transforming Cube Surface to Spherical Cube Surface (Generating Spherical Cube)

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-05 11:32:08
问题 I have the coordinates of points of an empty cube just like down below: What I would like to do is transform that cube to something like this: There are two options: 1- Edit the initial cube's coordinates to make it spherical 2- Generate spherical cube from scratch I couldn't think of a solution so far. How can I generate a spherical cube? Edit - My code that generates the cube is below. It basically creates a filled cube and then subtracts the nodes on the inside. NL_sph is the final array

Calculating point to line distance in GLSL

时光总嘲笑我的痴心妄想 提交于 2021-02-05 09:28:14
问题 I am trying to calculate a point to line distance in GSLS - precisely in turbo.js turbo.js This is part of a more general problem in which I try to find the [closest points on GeoJSON multiline] respective to a set of GeoJSON points - the number of calculations for a 500-points set on 1000 segments line ends up being 500k point-to-distance calculations. This is way too much to handle in the browser (even in workers) so parallelism helps a lot. The trick is that AFAIK I can only use a vec4 as

用神经网络给照片补光,谷歌这项研究却实现了「鬼片」效果!(胆小勿入)

旧时模样 提交于 2021-02-05 06:05:44
打光是图像处理过程中的重要步骤,打光的好坏可能会影响整体效果的展示。打光方法也各有不同,MIT、谷歌等的一项新研究另辟蹊径,通过神经光传输方法进行图像的二次打光和视图合成,实现了相当不错的效果。 机器之心报道,编辑:魔王、杜伟、小舟。 图像合成早已不是新鲜话题,但是「打光」可是所有照片的难题。对于人类摄影师而言,打光就是件挺复杂的事,那么合成图像中的光线问题又该如何解决呢? 最近,来自 MIT、谷歌和加州大学圣地亚哥分校的研究人员进行了一项研究,试图 通过神经光传输(Neural Light Transport,NLT)对图像进行二次打光(relighting)和视图合成(view synthesis) 。 那么,这项研究提出的 NLT 方法效果如何呢?研究者在多个场景下进行了测试,包括 Directional Relighting、基于不同图像背景的打光、根据摄像头路径不同进行视图合成后的打光效果等等。 效果看起来不错,就是有点像鬼片……(瑟瑟发抖 具体而言,在 Directional Relighting 场景下,NLT 实现了如下效果: 在基于图像的 Relighting 场景下,人物的打光效果随着背景图像的变换而不断调整: 那么在涉及视图合成时,效果如何呢? 同时进行二次打光和视图合成呢? 想查看更多效果?请戳以下视频: https://v.qq.com/x/page

Is there a more efficient way of texturing a circle?

旧城冷巷雨未停 提交于 2021-02-04 08:24:10
问题 I'm trying to create a randomly generated "planet" (circle), and I want the areas of water, land and foliage to be decided by perlin noise, or something similar. Currently I have this (psudo)code: for (int radius = 0; radius < circleRadius; radius++) { for (float theta = 0; theta < TWO_PI; theta += 0.1) { float x = radius * cosine(theta); float y = radius * sine(theta); int colour = whateverFunctionIMake(x, y); setPixel(x, y, colour); } } Not only does this not work (there are "gaps" in the