coordinates

OpenGL scene coordinates to screen coordinates

给你一囗甜甜゛ 提交于 2019-12-07 02:27:26
I'm having trouble converting my OpenGL scene coordiates to my screen coordinates. I thought I needed to multiply my coordinates with the modelview matrix then with the projection matrix to get the ndc. But i'm getting weird coordinates. Here is my piece of code GLKVector3 coor = GLKVector3Make(point.x, point.y, 0); GLKMatrix4 modelview = GLKMatrix4MakeWithArray(glProjectionMatrix); GLKMatrix4 projetion = GLKMatrix4MakeWithArray(modelViewMatrix.data); GLKVector3 eyeCoor = GLKMatrix4MultiplyVector3(modelview, coor); GLKVector3 ndcCoor = GLKMatrix4MultiplyVector3(projetion,eyeCoor); CGPoint p =

Use X,Y coordinates to plot points inside a circle

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 01:21:36
问题 Is there a way in javascript to plot x,y coordinates so they fall into a circle rather than a square? For example if I have the following code: circleRadius = 100; context.drawImage(img_elem, dx, dy, dw, dh); I need to figure out a combination of x,y values that would fall inside a 100 pixel circle. Thanks! 回答1: choose an x at random between -100 and 100 a circle is defined by x^2 + y^2 = r^2 , which in your case equals 100^2 = 10000 From this equation you can get that y^2 = 10000 - x^2 ,

ARKit - Update only the world coordinates origin

て烟熏妆下的殇ゞ 提交于 2019-12-06 14:46:28
问题 Once the user has scanned the environment and that I detected a plane, I would like the world origin anchor, which is the device position when the app opens (which is the origin of the 3D world), to be reset to where my device is right now so that the user can see my AR objects in front of him. (my objects are floating and not related to the floor but detecting a plane makes the objects more stable) I didn't find a way to do that. It's linked to ARConfiguration but it doesn't seem like we can

Distance between two sets of points [duplicate]

依然范特西╮ 提交于 2019-12-06 14:13:45
问题 This question already has answers here : How to calculate Euclidian distance between two points defined by matrix containing x, y? (4 answers) Closed last year . So after looking at various Questions asked here on stackoverflow I'm still not able to wrap my head around the dist function in R or maybe even a distance matrix in general. So I have two dataframes with xy-coordinates. df1 <- data.frame(x = runif(3,0,50), y = runif(3,0,50)) df2 <- data.frame(x = runif(20,0,50), y = runif(20,0,50))

Plotting Clusters using clusplot with coordinates centered around 0

…衆ロ難τιáo~ 提交于 2019-12-06 13:35:37
I am trying to plot GIS coordinates, specifically UK national Grid Coordinates which eastings and northings ressemble: 194630000 562220000 I can plot these using clusplot in the Cluster library: clusplot (df2,k.means.fit$cluster,main=i,color=TRUE,shade=FALSE,labels=0,lines=0,bty="7") where df2 is my data frame and k.means.fit is the result of the K means analysis on df2. Note that the coordinates of the centers after the k means analysis have not been normalised: k.means.fit$centers # Grid.Ref.Northing Grid.Ref.Easting #1 206228234 581240726 But when I plot the clusters, all the points are

Python Open CV2 Color Detection Mask to Pixel Coordinates

柔情痞子 提交于 2019-12-06 13:33:38
I am currently working in Python to do color detection on a single image. After loading my image and establishing my RGB (or BGR in CV2), I use the following 2 lines to produce a mask and a output image. mask = cv2.inRange(image, lower, upper) output = cv2.bitwise_and(image, image, mask = mask) Then the code displays the following image. But now, I would like to take the processed image and extract pixel coordinate points for the green line. Thanks. Any help would be appreciated. Soltius So, how about findNonZeros() on a binarised version of your image ? Starting with the image with the green

Check coordinate point between two points

混江龙づ霸主 提交于 2019-12-06 13:30:58
I need to verify if a coordinate LAT/LNG point is between other two points (a segment line like a road). I followed THIS topic with no success. function inRange(start, point, end) { start_x = start.lat(); start_y = start.lng(); end_x = end.lat(); end_y = end.lng(); point_x = point.lat(); point_y = point.lng(); var dx = end_x - start_x; var dy = end_y - start_y; var innerProduct = (point_x - start_x)*dx + (point_y - start_y)*dy; return 0 <= innerProduct && innerProduct <= dx*dx + dy*dy; } function checkRange(start, point, end){ var x1 = start.lat(); var y1 = start.lng(); var x2 = end.lat(); var

How do I increase or decrease the size of a button in Swift?

大城市里の小女人 提交于 2019-12-06 13:22:44
问题 I have a UIButton in my app that I call "buttonPlay". I am using AutoLayout but the button doesn't have any NSLayoutConstraints attached to it. I would like to code an animation to increase and the decrease the height and the width of the button. Here's how the animation code looks like: // "Repeat" because the animation must repeat itself UIView.animateWithDuration(1.0, delay: 0.6, options: UIViewAnimationOptions.Repeat, animations: { // Animation code goes here // nil: the animation is not

Appropriate similarity metrics for multiple sets of 2D coordinates

删除回忆录丶 提交于 2019-12-06 13:22:25
I have a collection of 2D coordinate sets (on the scale of a 100K-500K points in each set) and I am looking for the most efficient way to measure the similarity of 1 set to the other. I know of the usuals: Cosine, Jaccard/Tanimoto, etc. However I am hoping for some suggestions on any fast/efficient ones to measure similarity, especially ones that can cluster by similarity. Edit 1: The image shows what I need to do. I need to cluster all the reds, blues and greens by their shape/orientatoin, etc. alt text http://img402.imageshack.us/img402/8121/curves.png It seems that the first step of any

Extract nodal coordinates from the deformed testsubject (abaqus-python)

青春壹個敷衍的年華 提交于 2019-12-06 12:38:04
I am trying to make a python script to extract the nodal coordinates from the ODB file (from abaqus). So far i have come up with the code attached below (don't mind the extra information i put behind the #, sometimes it's just so i can keep track of what i'm doing) The problem is that the coordinates i extract are those from the undeformed test subject. and i need the coordinates of the nodes from the deformed test subject. Can somebody help me with how i reach this information using python code? from abaqus import * from abaqusConstants import * import __main__ import section import