coordinate

JavaFX imageview real coordinates translateX and translateY

僤鯓⒐⒋嵵緔 提交于 2019-12-01 14:53:54
And why the translateX and translateY is bad position on my scene ? I start on coordinate x = 100 y = 200 in real my real coordinate y = -24.8 ... why ? I need real coordinates when is my ImageView is ? primaryStage.setTitle("Title"); Group root = new Group(); Scene scene = new Scene(root, 800, 600, Color.WHITE); // border.prefHeightProperty().bind(scene.heightProperty()); //border.prefWidthProperty().bind(scene.widthProperty()); Image im = new Image("Images/universe.jpg", 800, 600, true, true); ImageView iv = new ImageView(im); Image iv1 = new Image("Images/Asteroid.png", 60, 50, false, false

how to click on a special coordinate android screen?

↘锁芯ラ 提交于 2019-12-01 14:34:36
How can i click on a point of android device screen with give it coordinates? I want to click without touch the screen with my finger. I want to click with the app. any idea? I know we can click and there is a solution. I think you can try to execute input tap x y in your app if the coordinate you want to touch is x , y . Or you can try to execute this command through adb in your PC. 来源: https://stackoverflow.com/questions/29326532/how-to-click-on-a-special-coordinate-android-screen

android: why getrotationmatrix return false?

泄露秘密 提交于 2019-12-01 05:32:36
I want to get the orientation of my phone and I have using this code that I find lot of people using it. this is the code public void onSensorChanged(SensorEvent event) { //if the data sensor is unreliabel if(event.accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) return; //gets the value switch (event.sensor.getType()) { case Sensor.TYPE_ACCELEROMETER: gravity = event.values.clone(); break; case Sensor.TYPE_MAGNETIC_FIELD: geomag = event.values.clone(); break; } getOrientation(); } private void getOrientation(){ //if gravity n geomag have value, find the rotation matrix if(gravity != null &

Java MouseEvent position is inaccurate

社会主义新天地 提交于 2019-11-30 16:56:43
I've got a problem in Java using a "canvas" class I created, which is an extended JPanel , to draw an animated ring chart. This chart is using a MouseListener to fetch click events. The problem is that the mouse position does not seem to be accurate, meaning it does not seem to be relative to the "canvas" but instead relative to the window (in the left, upper corner I got about 30px for y coord). This is my code: I created a class, that extends JPanel and does have a BufferedImage as member. public class Canvas extends JPanel { public BufferedImage buf; private RingChart _parent; public Canvas

Java: What is a good data structure for storing a coordinate map for an infinite game world?

感情迁移 提交于 2019-11-29 20:35:38
I am used to coding in PHP but I am not really proficient with Java and this has been a problem for some time now. I expect it to be a fairly easy solution, however I cannot find any good example code any way I search it, so here goes: I am programming a game that takes place in a 2d random generated infinite world on a tile based map (nitpicking: I know it will not be truly infinite. I just expect the world to be quite large). The usual approach of map[x][y] multidimensional array started out as a basic idea, but since Java does not provide a way for non-integer (i.e. negative) array key

Transfer coordinates from one triangle to another triangle

↘锁芯ラ 提交于 2019-11-29 07:57:42
I have two triangles , which can be in any sizes. The problem is that, how I can transfer coordinates from one triangle to another? I know both of triangle position in coordinate system and yes, they both are in one system. Basically, i have point in triangle1 and I need to transfer it in triangle2. Reading some posts, I found out that I could be calculated using affine transformation matrix , but I didn't undestand how to solve this with affine transformation matrix. Thank you for any help. Let's you have unknown affine transformation matrix | a c e | M =| b d f | | 0 0 1 | first triangle

Java: What is a good data structure for storing a coordinate map for an infinite game world?

不想你离开。 提交于 2019-11-28 16:39:13
问题 I am used to coding in PHP but I am not really proficient with Java and this has been a problem for some time now. I expect it to be a fairly easy solution, however I cannot find any good example code any way I search it, so here goes: I am programming a game that takes place in a 2d random generated infinite world on a tile based map (nitpicking: I know it will not be truly infinite. I just expect the world to be quite large). The usual approach of map[x][y] multidimensional array started

ggplot2 polar plot arrows

你。 提交于 2019-11-27 22:32:20
I can use ggplot2 easily to draw a graph like below: In fact, for my data, it is like below: degree value 1 120 0.50 2 30 0.20 3 -120 0.20 4 60 0.50 5 150 0.40 6 -90 0.14 7 -60 0.50 8 0 0.60 The first column is the degree (from -180 to 180 or from 0 to 360), the second column is the corresponding values. So I want to draw a graph point from (0,0) to each my data point with arrow but with a circular coordinate as below: 2 http://www.matrixlab-examples.com/image-files/polar_plots_1.gif I try to use follow code: base <- ggplot(polar, aes(x=degree, y=value)) p <- base + coord_polar() p <- p + geom

How to get 3D coordinate Axes of head pose estimation in Dlib C++

喜欢而已 提交于 2019-11-27 20:53:19
Dlib C++ can detect landmark and estimate face pose very well. However, how can I get 3D coordinate Axes direction (x,y,z) of head pose? I was also facing the same issue, a while back ago, searched and found 1-2 useful blog posts, this link would get you an overview of the techniques involved, If you only need to calculate the 3D pose in decimal places then you may skip the OpenGL rendering part, However if you want to visually get the Feedback then you may try with OpenGL as well, But I would suggest you to ignore the OpenGL part as a beginner, So the smallest working code snippet extracted

Faster numpy cartesian to spherical coordinate conversion?

一曲冷凌霜 提交于 2019-11-27 12:04:44
I have an array of 3 million data points from a 3-axiz accellerometer (XYZ), and I want to add 3 columns to the array containing the equivalent spherical coordinates (r, theta, phi). The following code works, but seems way too slow. How can I do better? import numpy as np import math as m def cart2sph(x,y,z): XsqPlusYsq = x**2 + y**2 r = m.sqrt(XsqPlusYsq + z**2) # r elev = m.atan2(z,m.sqrt(XsqPlusYsq)) # theta az = m.atan2(y,x) # phi return r, elev, az def cart2sphA(pts): return np.array([cart2sph(x,y,z) for x,y,z in pts]) def appendSpherical(xyz): np.hstack((xyz, cart2sphA(xyz))) mtrw This