point

MongoDB How to find which polygon contains a specified Point?

一曲冷凌霜 提交于 2019-12-10 06:14:58
问题 I insert many polygons into MongoDB(2.4.8), and hope find the polygon a specified Point sits in. It seems a common question. But after reading all docs from google, I didn't get the result. So create this question. e.g. db.addr_poly.insert( { loc : { type : "Polygon" , coordinates : [ [ [ 0 , 0 ] , [ 3 , 6 ] , [ 6 , 1 ] , [ 0 , 0 ] ] ] } }) db.addr_poly.insert( { loc : { type : "Polygon" , coordinates : [ [ [ 0 , 0 ] , [ -3 , -6 ] , [ -6 , -1 ] , [ 0 , 0 ] ] ] } }) Now how to find the polygon

Find point on Circle on Android

試著忘記壹切 提交于 2019-12-09 16:59:32
问题 Everything seemed so plain and simple until I had to actually program it. What I've got I uploaded an image to explain it better. I have a circle and I know it's radius center point coordinates each button's initial coordinates (the red circles). I want to be able, when I rotate the gray circle image, with 10 degrees, to calculate red buttons new coordinates (x1y1, x2y2). This shouldn't be hard to achieve for someone who knows math, but I didn't manage to find a suitable solution. I've also

Calculate middle point of Bezier Curve

血红的双手。 提交于 2019-12-09 16:53:23
问题 I have a function to draw Bezier Curve through three points. I have already 2 points (start and end) - A and B. How do I calculate middle point between those two points as middle point would be always a little higher or lower than linear function of those two points. Example : Any formulas, ideas would be great! 回答1: I think this is what you're looking for: http://blog.sklambert.com/finding-the-control-points-of-a-bezier-curve/ It goes into detail on calculating the various points on a Bezier

Textured points in OpenGL ES 2.0?

為{幸葍}努か 提交于 2019-12-09 15:46:21
问题 I'm trying to implement textured points (e.g. point sprites) in OpenGL ES 2.0 for a particle system. Problem I'm having is the points all render as solid black squares, rather than having the texture properly mapped. I have verified that gl_PointCoord is in fact returning x/y values from 0.0 to 1.0, which would map across the entire texture. The texture2D call always seems to return black though. My vertex shader : attribute vec4 aPosition; attribute float aAlpha; attribute float aSize;

The best way for finding the closest line segment to a point

℡╲_俬逩灬. 提交于 2019-12-09 06:28:48
问题 As can be seen in figure below, I have some lines (finite length) between any two joints (red points), such as the line between joints J1 and J2. I have also some points such as P1 and P2. I have the coordinates of points and joints. So, it is possible to calculate the line equations (y=mx+b). So, it is possible to calculate the distance between a point to any line. So, the lowest distance gives me the closest line to the point. Since there are a huge number of points in this problem, it

Java Point, difference between getX() and point.x

☆樱花仙子☆ 提交于 2019-12-09 03:13:54
问题 I am confused to as why the Java Point class takes in two int paramaters and the getX() and getY() methods return doubles. For example I could define a Point Point p = new Point(4,6); If I were to call.. p.getX(); It would return 4.0. and if I were to call p.x; I would get 4. Any reason for this? 回答1: There are Point2D.Double and Point2D.Float classes that extend Point2D which is a superclass of Point and they need to be able to work with floating point values. Note that there is also a

how to make circle in matlab and generate random points inside it

落花浮王杯 提交于 2019-12-09 03:12:02
问题 hello i want to ask a question how to make a circle in matlab and mark its center and generate a certain number of random points inside it for example 50 ? i know this code to make a circle x = linspace(-sqrt(10),sqrt(10)); y1 = sqrt(10-x.^2); y2 = -sqrt(10-x.^2); plot(x,y1,x,y2) axis equal hold on but i don't know how to generate 50 random points inside it then i thought of this pseudo code but i don't know how to write it in matlab 01: FOR all nodes j 02: FOR all nodes i except node j 03:

Why does java.awt.Point provide methods to set and get doubles but store x and y as int's?

感情迁移 提交于 2019-12-08 19:26:46
问题 As you can see in the Oracle Documentation for java.awt.Point, x and y are stored as int . However, getX and getY return double . While there is a setLocation method that takes 2 double types, there is no constructor that does. Furthermore, the double gets truncated to an int internally anyway. Is there a good reason for this? You might avoid a cast on setLocation by having a method that takes double types, but you have the opposite problem when you call getX and getY . There's also a

Django: Filtering Queryset From Two Model Fields

拜拜、爱过 提交于 2019-12-08 13:37:46
问题 My model has two fields (latitude and longitude) that I want to combine to form a point object. However, I cannot figure out how to filter based on a combination of those values: For example: >>> from django.contrib.gis.geos import Point >>> lat = 5 >>> lon = 1 >>> pnt = Point(lat, lon) >>> buf = pnt.buffer(0.0001) >>> z = Thing.objects.filter(pnt__intersects=buf) FieldError: Cannot resolve keyword 'pnt' into field. ## I dont have a model field named pnt I realize this is not the right

Android recording coordinates of the point in screen

纵饮孤独 提交于 2019-12-08 09:37:02
问题 My activity should record the coordinates of a point on the screen, which the user can move. Specifically, the user touches the screen and appears on the item, which will be able to move. When you lift your finger, the coordinates of the point should be recorded.Please for your advice. 回答1: EDITED Here is whole simple activity which Toasts the user touch down and touch up co-ordinates import android.os.Bundle; import android.app.Activity; import android.view.MotionEvent; import android.widget