intersection

Generic TypeScript interface with mixed member types

≯℡__Kan透↙ 提交于 2019-12-07 21:10:33
问题 For several HTML forms, I want to configure inputs and deal with their values. My types have the following structure (you may copy it to TypeScript Playground http://www.typescriptlang.org/play to see it in action): interface InputConfig { readonly inputType: "text" | "password" | "list" readonly attributes?: ReadonlyArray<string> readonly cssClasses?: ReadonlyArray<string> } interface Inputs<T extends InputConfig | string | string[]> { readonly username: (T & InputConfig) | (T & string)

Ray-triangle intersetion

拟墨画扇 提交于 2019-12-07 19:37:34
问题 How can I test intersesion ray and triangle, and if it exist how to get distance from ray origin to intersection point?? What optimization I can use, if in my program I've got to check 1 ray to ~10000 triangles ?? 回答1: A single polygon-ray intersection test is trivial and just involves making sure that the ray crosses at least one side of it (check them individually) or across the plane defined by the triangle between the sides of it. The optimization comes into not checking against polygons

Determining which screen a window is on (by checking where the most surfacearea is located)

情到浓时终转凉″ 提交于 2019-12-07 13:40:14
问题 I'm currently determining which screen a window is on, by checking on which screen it's very left-top position is. Now I'd like to change that so that I can find out on which scren the most surface area of the window is to be found. Any ideas how that can be accomplished? Here is my old code: (it simply moves the active window between all available screens when pressing F1) F1:: WinGetPos, X, Y,,, A window := {x:X,y:Y} monitors := GetMonitors() Loop % monitors.MaxIndex() { curMonitor :=

Connect an even number of nodes without intersection

梦想与她 提交于 2019-12-07 03:46:18
问题 I have two sets of n nodes. Now I want to connect each node from one set with another node from the other set. The resulting graph should have no intersections. I know of several sweep line algorithms (Bentley-Ottmann-Algorithm to check where intersections occur, but I couldn't find an algorithm to solve those intersections, except for a brute-force approach. Each node from one set can be connected to any other node within the other set. Any pointers to (an efficient) algorithm that solves

Polygon intersection error in Shapely: “shapely.geos.TopologicalError: The operation 'GEOSIntersection_r' produced a null geometry”

折月煮酒 提交于 2019-12-07 03:14:46
问题 I have been trying to debug this problem but unable to do so. I am trying to find the intersection of two Polygon objects. It works most of the time but for the following case, it raises the following exception: P1 area: 13.125721955 P2 area: 1.0 Traceback (most recent call last): File "geom2d.py", line 235, in <module> print p1.intersection(p2) File "/usr/local/lib/python2.7/dist-packages/shapely/geometry/base.py", line 334, in intersection return geom_factory(self.impl['intersection'](self,

Computing circle intersections in O( (n+s) log n)

风格不统一 提交于 2019-12-07 00:00:53
问题 I'm trying to figure out how to design an algorithm that can complete this task with a O((n+s) log n) complexity. s being the amount of intersections. I've tried searching on the internet, yet couldn't really find something. Anyway, I realise having a good data structure is key here. I am using a Red Black Tree implementation in java: TreeMap. I also use the famous(?) sweep-line algorithm to help me deal with my problem. Let me explain my setup first. I have a Scheduler. This is a

Why does raytracer render spheres as ovals?

三世轮回 提交于 2019-12-06 23:52:24
问题 I've been hacking up a raytracer for the first time over the past few days. However, there are a few quirks which bother me and I don't really know how to work out. One that has been there since the beginning is the shape of spheres in the scene - when rendered, they actually look like ovals. Of course, there is perspective in the scene, but the final shape still seems odd. I have attached a sample rendering, the problem I have is especially visible on the reflective sphere in the lower left

JavaFX 8 3D scene intersection point

僤鯓⒐⒋嵵緔 提交于 2019-12-06 23:52:13
问题 Is it possible in a JavaFX 8 3D scene to find points along a ray (e.g. PickRay), starting at an arbitrary point in 3D space with some 3D direction vector, where the ray intersects the triangles in a mesh (TriangleMesh inside a MeshView)? I know this is done in the Camera/MouseHandler for mouse picking but I can't see any way for doing it for arbitrary rays. 回答1: As @jdub1581 suggests, a ray is just a geometric vector, so in order to find a list of triangles intersected by this vector we need

Intersection of bands in R raster package

巧了我就是萌 提交于 2019-12-06 21:28:27
My input raster consists of multiple layers, each with an image area surrounded by no data values. These layers don't overlap completely, and I am trying to output a file which consists of only the intersection of all bands (the zone which has no NoData values on any layer). The following works for a few layers, but not for the 50+ that I have in my real files (at least 3000x3000 pixels): library(raster) fin = "D:\\temp\\all_modes.pix" fout = "D:\\temp\\test.pix" inbands = stack(fin, bands = c(3:20)) NAvalue(inbands) = 0 # Not great: #out = all(is.na(inbands) == FALSE) * inbands #writeRaster

Drawing outline of intersecting circles

核能气质少年 提交于 2019-12-06 20:22:08
问题 I have a set of points and each one has an area of "influence" or essentially a radius. I would like to be able to draw each one of these influence circles for all the points as a simple circular line. They will overlap however I wish to draw the outside of the shape formed. I know this would probably require me working out where they intersect and somehow forming a total shape to draw. The problem is that some points might not even touch others! So I need to be able to work that out too. I