geometry

Finding the intersection of the Circle and Infinite Cylinder in 3D space

孤者浪人 提交于 2021-02-20 04:32:04
问题 Finding the intersection of the Circle and Infinite Cylinder. (all in 3D) • Circle is defined by center, plane in which it lies and radius. • Cylinder is defined by axis and radius. how can i get the intersection of these two? 回答1: WLOG the cylinder has equation X² + Y² = 1 (if not, you can make it so by translation, rotation and scaling). Then the parametric equation of the circle is P = C + U cos t + V sin t where C is the center point and U , V two orthogonal vectors in the circle plane,

Filling a polygon

妖精的绣舞 提交于 2021-02-19 08:44:17
问题 I created this function that draws a simple polygon with n number of vertexes: void polygon (int n) { double pI = 3.141592653589; double area = min(width / 2, height / 2); int X = 0, Y = area - 1; double offset = Y; int lastx, lasty; double radius = sqrt(X * X + Y * Y); double quadrant = atan2(Y, X); int i; for (i = 1; i <= n; i++) { lastx = X; lasty = Y; quadrant = quadrant + pI * 2.0 / n; X = round((double)radius * cos(quadrant)); Y = round((double)radius * sin(quadrant)); setpen((i * 255)

Split a linestring at each point it crosses a polygon in shapely

别说谁变了你拦得住时间么 提交于 2021-02-19 08:28:39
问题 I have a linestring which spans various polygons, stored as GeoJsons. I want to split the line into individual parts within each polygon area. I have not been able to achieve this yet, however. This is a reproducible example for what I have so far: from shapely.geometry import Point, LineString, Polygon from shapely.ops import split from matplotlib import pyplot as plt poly = { 'type': "Feature", 'geometry': { "type": "Polygon", "coordinates": ([(2,2),(2,4),(4,4),(4,2)]), }, 'properties': {

Trilateration C# How to get back into “normal” coordinates?

荒凉一梦 提交于 2021-02-19 06:15:27
问题 I am trying to calculate my location with help of 3 stations (p1,p2,p3) with radius (r1,r2,r3). Stations are in 3D space. Example 1: P1=(2,2,0), P2=(3,3,0), P3=(1,4,0) r1=1 r2=1 r3=1.4142 Result should be: P=(2,3,0) Example 2: P1=(2,1,0), P2=(4,3,0), P3=(4,4,1) r1=2, r2=2, r3=2.449 Result should be: P=(2,3,0) My code: private void button1_Click(object sender, EventArgs e) { double x1, x2, x3, y1, y2, y3, z1, z2, z3; double.TryParse(textBox1.Text, out x1); double.TryParse(textBox2.Text, out x2

How to get a point on an ellipse's outline given an angle?

与世无争的帅哥 提交于 2021-02-19 05:43:29
问题 So, I have ellipses given - they are defined by their midpoint, an horizontal radius(rh) and an vertical radius(rv). I'm drawing them using sin/cos and the result looks fairly good to me(just making sure this isn't an error source). Now say I have an angle(or a direction vector) given and I want to have the point on the ellipse's outline with that angle/direction. My intuitive approach was to simply use the direction vector, normalise it and multiply its x-component with rh, its y-component

How to get a point on an ellipse's outline given an angle?

瘦欲@ 提交于 2021-02-19 05:43:05
问题 So, I have ellipses given - they are defined by their midpoint, an horizontal radius(rh) and an vertical radius(rv). I'm drawing them using sin/cos and the result looks fairly good to me(just making sure this isn't an error source). Now say I have an angle(or a direction vector) given and I want to have the point on the ellipse's outline with that angle/direction. My intuitive approach was to simply use the direction vector, normalise it and multiply its x-component with rh, its y-component

Interpolating missing contour lines between existing contour lines

不问归期 提交于 2021-02-19 05:41:47
问题 Contour lines (aka isolines) are curves that trace constant values across a 2D scalar field. For example, in a geographical map you might have contour lines to illustrate the elevation of the terrain by showing where the elevation is constant. In this case, let's store contour lines as lists of points on the map. Suppose you have map that has several contour lines at known elevations, and otherwise you know nothing about the elevations of the map. What algorithm would you use to fill in

Draw a D3 circle with gradient colours

旧时模样 提交于 2021-02-18 04:53:39
问题 How to draw a circle with gradient color? Say, a gradient from yellow to blue. Normally, to create a circle in yellow we can use the following code: var cdata=[50,40]; var xscale=40; var xspace =50; var yscale=70; var svg = d3.select("body") .append("svg") .attr("width", 1600) .attr("height", 1600); var circle = svg.selectAll("circle") .data(cdata) .enter() .append("circle"); var circleattr = circle .attr("cx", function(d) { xscale = xscale+xspace; return xscale; }) .attr("cy", function(d) {

Dynkin Diagrams and How they work

戏子无情 提交于 2021-02-18 01:16:49
Download Here is the document DynkinDiag(20200401).pdf Dynkin diagram, root system is a big mystery of my undergraduate life. Here I present three examples tha place they work. Warning Since my main interest is not algebraic geometry, maybe there is something wrong or unacceptable, please inform me if you have good reference. This proof and concepts are collected from Shafarevich. Contents 1. Definitions 1.1 Integral Quadratic Forms 1.2 Abstract Root systems 1.3 Dynkin Diagrams Exercises: Relative Concepts 1.4 Basis determine root system 1.5 More about Weyl groups 1.6 Classification of Dynkin

Radius of projected sphere in screen space

不打扰是莪最后的温柔 提交于 2021-02-17 22:10:49
问题 I'm trying to find the visible size of a sphere in pixels, after projection to screen space. The sphere is centered at the origin with the camera looking right at it. Thus the projected sphere should be a perfect circle in two dimensions. I am aware of this 1 existing question. However, the formula given there doesn't seem to produce the result I want. It is too small by a few percent. I assume this is because it is not correctly taking perspective into account. After projecting to screen