distance

Define home area-turtles?

别说谁变了你拦得住时间么 提交于 2019-12-02 02:34:55
I am very new to netlogo. I have searched every question here before I posted this. I have the following code which sprouts a given number of horses: ask n-of Number-horses patches with [grass? = "Yes"] [sprout-horses 1 [set color 25 ]] The person can change the number of horses using the slider but I would like each horse to have its own area/range/radius. They can only move within this radius/area and they cannot meet each other. From what I've read it's got something to do with the distance function? You can find a similar problem here which has examples too : Spacing agents in NetLogo

How to accurately measure mouse movement in inches or centimetres for a mouse with a known DPI

强颜欢笑 提交于 2019-12-02 02:07:50
问题 I have a Logitech G500 gaming mouse that is running at its full DPI of 5700. I'm trying to write a program in C++ that accurately measures horizontal movement of the mouse in physical units, ie. centimetres or inches. I'm using the windows API and windows raw input via the WM_INPUT message to get raw movement changes from the mouse. I'm then assuming 1 unit of movement reported through WM_INPUT is 1/5700th of an inch, and as I'm tracking the net movement of the mouse, I thought I could

Modifying Levenshtein Distance for positional Bias

℡╲_俬逩灬. 提交于 2019-12-02 02:07:36
I am using the Levenshtein distance algorithm to compare a company name provided as a user input against a database of known company names to find closest match. By itself, the algorithm works okay, but I want to build in a Bias so that the edit distance is considered lower if the initial parts of the strings match. For Example, if the search criteria is "ABCD", then both "ABCD Co." and "XYX ABCD" have identical Edit Distance. However I want to add weight to the fact that the initial parts of the first string matches the search criteria more closely than the second string. One way of doing

Calculate distance between 2 lon lats but avoid going through a coastline in R

≡放荡痞女 提交于 2019-12-02 01:57:42
I am trying to calculate the closest distance between locations in the ocean and points on land but not going through a coastline. Ultimately, I want to create a distance to land-features map. This map was created using rdist.earth and is a straight line distance. Therefore it is not always correct because it not taking into account the curvatures of the coastline. c<-matrix(coast_lonlat[,1], 332, 316, byrow=T) image(1:316, 1:332, t(c)) min_dist2_feature<-NULL for(q in 1:nrow(coast_lonlat)){ diff_lonlat <- rdist.earth(matrix(coast_lonlat[q,2:3],1,2),as.matrix(feature[,1:2]), miles = F) min

Some questions about OpenGL transparency

对着背影说爱祢 提交于 2019-12-02 01:54:02
问题 I have two questions about OpenGL blending. 1) I know I have to draw opaque objects first and then draw from back to front the non-opaque ones. So I put them in a list depending in the distance to the center (0,0,0). But do transformations (rotate and translate) affect the "center" from where I measure the distance? 2) And second, if the items I draw are triangles, how do I measure the distance? To its incenter? To its orthocenter? 回答1: You certainly need to take the transformations into

Define home area-turtles?

眉间皱痕 提交于 2019-12-02 01:36:30
问题 I am very new to netlogo. I have searched every question here before I posted this. I have the following code which sprouts a given number of horses: ask n-of Number-horses patches with [grass? = "Yes"] [sprout-horses 1 [set color 25 ]] The person can change the number of horses using the slider but I would like each horse to have its own area/range/radius. They can only move within this radius/area and they cannot meet each other. From what I've read it's got something to do with the

How to accurately measure mouse movement in inches or centimetres for a mouse with a known DPI

◇◆丶佛笑我妖孽 提交于 2019-12-02 01:29:07
I have a Logitech G500 gaming mouse that is running at its full DPI of 5700. I'm trying to write a program in C++ that accurately measures horizontal movement of the mouse in physical units, ie. centimetres or inches. I'm using the windows API and windows raw input via the WM_INPUT message to get raw movement changes from the mouse. I'm then assuming 1 unit of movement reported through WM_INPUT is 1/5700th of an inch, and as I'm tracking the net movement of the mouse, I thought I could perform a simple calculation to yield the net physical movement: distance(inches) = total_movement_from

Some questions about OpenGL transparency

馋奶兔 提交于 2019-12-02 00:50:45
I have two questions about OpenGL blending. 1) I know I have to draw opaque objects first and then draw from back to front the non-opaque ones. So I put them in a list depending in the distance to the center (0,0,0). But do transformations (rotate and translate) affect the "center" from where I measure the distance? 2) And second, if the items I draw are triangles, how do I measure the distance? To its incenter? To its orthocenter? You certainly need to take the transformations into account for sorting. Applying all the transformations, and then sorting by the resulting depth (z-coordinate),

How to calculate Euclidean distance (and save only summaries) for large data frames

谁说我不能喝 提交于 2019-12-01 21:56:05
问题 I've written a short 'for' loop to find the minimum euclidean distance between each row in a dataframe and all the other rows (and to record which row is closest). In theory this avoids the errors associated with trying to calculate distance measures for very large matrices. However, while not that much is being saved in memory, it is very very slow for large matrices (my use case of ~150K rows is still running). I'm wondering whether anyone can advise or point me in the right direction in

How to calculate Euclidean distance (and save only summaries) for large data frames

*爱你&永不变心* 提交于 2019-12-01 20:47:38
I've written a short 'for' loop to find the minimum euclidean distance between each row in a dataframe and all the other rows (and to record which row is closest). In theory this avoids the errors associated with trying to calculate distance measures for very large matrices. However, while not that much is being saved in memory, it is very very slow for large matrices (my use case of ~150K rows is still running). I'm wondering whether anyone can advise or point me in the right direction in terms of vectorising my function, using apply or similar. Apologies for what may seem a simple question,