coordinates

OpenGL Coordinates from Bezier Curves

会有一股神秘感。 提交于 2019-11-28 20:57:18
Basically, I need to get all the coordinates drawn from a Bezier curve implementation in OpenGL. Specifically, I need the coordinates to move a sphere object (baseball) in my scene along a curved trajectory path. This is what I use to draw my curve: GL2 gl = drawable.getGL().getGL2(); float ctrlpoints[][] = new float[][]{ {0.0f, 0.0f, 60f}, {0.0f, 3.0f, 45.0f}, {0.0f, 2.0f, 15.0f}, {0.0f, 1.0f, 0f}}; FloatBuffer ctrlpointBuf = FloatBuffer.allocate(ctrlpoints[0].length * ctrlpoints.length); for (int i = 0; i < ctrlpoints.length; i++) { for (int j = 0; j < 3; j++) { ctrlpointBuf.put(ctrlpoints[i

How to calculate an angle from points?

↘锁芯ラ 提交于 2019-11-28 18:35:00
I want to get a simple solution to calculate the angle of a line (like a pointer of a clock). I have 2 points: cX, cY - the center of the line. eX, eY - the end of the line. The result is angle (0 <= a < 360). Which function is able to provide this value? Christian Mann You want the arctangent: dy = ey - cy dx = ex - cx theta = arctan(dy/dx) theta *= 180/pi // rads to degs Erm, note that the above is obviously not compiling Javascript code. You'll have to look through documentation for the arctangent function. Edit: Using Math.atan2(y,x) will handle all of the special cases and extra logic for

Get new position of coordinate after rotation with Matrix

谁都会走 提交于 2019-11-28 18:16:23
I'm wondering how to use a Matrix to get the new position of a coordinate within a rectangle after rotation. What I would like to do is: Define a rectangle Define a coordinate within that rectangle Rotate the rectangle Get the new position of the coordinate after the rotation The parts I can't figure out are 2 & 4. Any ideas? I have created a simple Demo for this. It has a little extra, so you can also see how to use this in Drawing. main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android

Create Google Maps links based on coordinates

不打扰是莪最后的温柔 提交于 2019-11-28 16:59:43
问题 How can I create Google Maps links based on coordinates. Their new basic share urls contain a lot of parameters, for example - https://www.google.com/maps/place/Vetlanda,+Sweden/@57.4217311,15.0849255,13z/data=!3m1!4b1!4m2!3m1!1s0x465758d912d321b5:0x55675191e550be84?hl=en Any ideas? Not looking to embed but just to create external links that can be shared. 回答1: Why not http://www.google.com/maps/place/lat,lng I think this is the simplest way http://www.google.com/maps/place/49.46800006494457

Sort latitude and longitude coordinates into clockwise ordered quadrilateral

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 16:51:33
Problem Users can provide up to four latitude and longitude coordinates, in any order. They do so with Google Maps. Using Google's Polygon API (v3), the coordinates they select should highlight the selected area between the four coordinates. Question How do you sort an array of latitude and longitude coordinates in (counter-)clockwise order? Solutions and Searches StackOverflow Questions Drawing resizable (not intersecting) polygons How to sort points in a Google maps polygon so that lines do not cross? Sort Four Points in Clockwise Order Related Sites http://www.daftlogic.com/projects-google

How do i open Google Maps for directions using coordinates on the iphone

萝らか妹 提交于 2019-11-28 16:14:42
I am using UIMapView to display locations on the iPhone. I want to do a directions from current location to the location of interest, I don't think its possible using MapKit (but if it is please inform) So I will open either the Google Maps application or safari to display it. Can i do this by specifying co-ordinates from (current location) to co-ordinates (the location of interest) I have these longitudes and latitudes. Or do i have to use street addresses? If I do have to use street addresses, can i get them from the latitude and longitude. iGo It is possible.Use MKMapView Get the location

How to get correct coords(event.getX() / event.getY()) of Object with OnTouchListener

佐手、 提交于 2019-11-28 14:37:09
I have this : and what i want exactly is that to show portion of Bitmap via coords (X,Y) of object with OnTouchListener(orange square with dot in center). So the problem is that i want to draw portion of image like it shows on image(Red square " Area that i want " to show). So in this case,excepted result is(portion of bitmap) : At current moment i'm doing like this: public boolean onTouch(View view, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_MOVE: Bitmap mBitmap = Bitmap.createBitmap(sourceBitmap,view.getX() - view.getWidth(),view.getY()-view.getHeight(),250,250

mismatch of event coordinates and view coordinates in Android?

吃可爱长大的小学妹 提交于 2019-11-28 14:31:23
I've been trying to write a little application that recognizes custom events in Android: you hold your finger over a TextView for a certain length of time, and it changes color. I'm using the MotionEvent coordinates and checking if they are within the bounds of a particular TextView, which is within a table. private boolean checkBounds(TextView v, MotionEvent event) { int[] origin = new int[2]; v.getLocationOnScreen(origin); if ((event.getX() > origin[0]) && (event.getX() < (origin[0] + v.getMeasuredWidth()))) { if ((event.getY() > origin[1]) && (event.getY() < (origin[1] + v.getMeasuredHeight

Store details of a binary image consisting simple polygons

牧云@^-^@ 提交于 2019-11-28 14:13:27
问题 This question relates to somewhat practice and experienced based process. I have an Mat binary image which consist of simple white color polygons in a black background. Actually those polygons represent an article in a newspaper page. So what I want is to store the details of the location of the article inside the newspaper page. One Mat image has only one polygon in it. So one option is to Use pure OpenCV calls to store Mat into a .xml or .yml file (How to write a Float Mat to a file in

Get the continent given the latitude and longitude [closed]

萝らか妹 提交于 2019-11-28 13:14:13
I want to have certain code such that given the latitude and longitude as input, I want to get the continent which it belongs to? I know I can manually read the coordinates and then see that from the map. But is there an easier way to do it? I've done this code just for getting the continent. It is not 100% exact, but pretty good for most territories. I did this to identify continents as asked by PVsyst, so I differenciate between Australia and Pacific, but this can be easily changed: If you do not want to differenciate between Australia and Pacific, just remove the Australian part (LatAus