line

determinate: is point on line segment

梦想的初衷 提交于 2020-01-07 06:56:07
问题 I am trying to code an java methods wich returns an boolean true if a point(x,y) is on a line segment and false if not. I tried this: public static boolean OnDistance(MyLocation a, MyLocation b, MyLocation queryPoint) { double value = java.lang.Math.signum((a.mLongitude - b.mLongitude) * (queryPoint.mLatitude - a.mLatitude) - (b.mLatitude - a.mLatitude) * (queryPoint.mLongitude - a.mLongitude)); double compare = 1; if (value == compare) { return true; } return false; } but it doesnt work.

Attach canvas drawed line to scene in Android

好久不见. 提交于 2020-01-07 06:41:06
问题 I would like to attach a line drawed with canvas to a Scene. I'm using andengine library. I know that andengine provides line objects that can be draw and attached to a scene, but this is not an option for me because i'm trying to make a pretty glow line. This is how a andengine line is attached to the scene. public class MainActivity extends SimpleBaseGameActivity implements OnClickListener { //--Declaration and implementation of all overrides, etc.-- @Override protected Scene onCreateScene(

How to merge multiple lines with gaps in threejs

[亡魂溺海] 提交于 2020-01-06 14:19:12
问题 I am successfully loading a dataset with polygon data that represent buildings in a city. So every polygon represents a single building. In Threejs I can successfully represent them, but when I try to merg the separate lines into one geometry, all the lines are connected (I understand why this makes sense, since all the vertices are added to the same collection). But how do I merge those separate building polygons into a single geometry without having the lines of the separate building

Too many values to unpack (expected 4)

£可爱£侵袭症+ 提交于 2020-01-06 08:51:57
问题 I have this piece of basic code just trying to split a file into 4 lists. The .txt file is formatted as shown underneath the code, with spaces delimiting each number. The error appearing is 'ValueError: too many values to unpack (expected 4)'. file = open("myfreefall.txt","r") for line in file: if not line.startswith('#'): v,a,t,y= line.split(' ') #v a t y -0.10 -9.81 0.01 5500.00 -0.20 -9.81 0.02 5500.00 -0.29 -9.81 0.03 5500.00 -0.39 -9.81 0.04 5499.99 -0.49 -9.81 0.05 5499.99 -0.59 -9.81 0

Too many values to unpack (expected 4)

不打扰是莪最后的温柔 提交于 2020-01-06 08:51:08
问题 I have this piece of basic code just trying to split a file into 4 lists. The .txt file is formatted as shown underneath the code, with spaces delimiting each number. The error appearing is 'ValueError: too many values to unpack (expected 4)'. file = open("myfreefall.txt","r") for line in file: if not line.startswith('#'): v,a,t,y= line.split(' ') #v a t y -0.10 -9.81 0.01 5500.00 -0.20 -9.81 0.02 5500.00 -0.29 -9.81 0.03 5500.00 -0.39 -9.81 0.04 5499.99 -0.49 -9.81 0.05 5499.99 -0.59 -9.81 0

OpenCV python: How do I draw a line using the gradient and the first point?

空扰寡人 提交于 2020-01-06 08:05:30
问题 I am trying to draw a line using a live feed with opencv. I am using one frame and storing the x,y coordinates. I use the next frame's x,y coordinate of the point to work out the gradient ((y2-y1)/(x2-x1)). I want to draw a straight line from the first coordinate straight through the second and continue past which would draw a trajectory. I can currently draw a straight line between the two points using cv2.line() . My code is below. Any suggestions would be wonderful! Thank you import numpy

Python学习之文件操作

醉酒当歌 提交于 2020-01-05 23:37:31
Python 处理普通文件(flat file) Python处理普通文件时,把数据从一个文件中读入内存,然后从内存写入文件。 使用open()打开文件 读写一个文件之前要打开它,格式如下: fileobj = open(filename, mode) • fileobj 是open() 返回的文件对象; • filename 是该文件的字符串名; • mode 是指明文件类型和操作的字符串。 mode的第一个字母表明对文件的操作类型: • r 表示读模式。 • w 表示写模式。如果文件不存在则新创建,如果存在则重写新内容。 • x 表示在文件不存在的情况下新创建并写文件。 • a 表示如果文件存在,在文件末尾追加写内容。 mode的第二个字母表示要操作的文件的类型: • t(或者省略)代表文本类型; • b 代表二进制文件。 使用read()/readline()/readlines()读取文本文件 read() 使用read()函数能够一次性读取文件所有内容,如下: >>> f_read = open('text2.txt','rt') >>> content = f_read.read() >>> print(content) This is the first line this is the second line third line ... Nth line End.

ggplot geom_line to date axis not working

泪湿孤枕 提交于 2020-01-05 11:44:33
问题 I have several data-sets similar to https://www.dropbox.com/s/j9ihawgfqwxmkgc/pred.csv?dl=0 Loading them from CSV and then plotting works fine predictions$date <- as.Date(predictions$date) plot(predictions$date, predictions$pct50) But when I want to use GGPLOT to draw these data predicted points into a plot to compare them with the original points like: p = ggplot(theRealPastDataValues,aes(x=date,y=cumsum(amount)))+geom_line() This command p + geom_line(predictions, aes(x=as.numeric(date), y

Pascal splitting line into real and strings

ⅰ亾dé卋堺 提交于 2020-01-05 05:43:07
问题 I know that this language have died a couple of years ago, but still required in most of schools in our country -.- I got file with data, which looks like: Number of lines Name Surname (real type digit) (another real type digit) For e.g. 2 Brat Sunbather 5.66 55.4 Bart Simpson 55.7 45.4 And I need to create result file, which looks like this: Name Surname (Previously given real type digits multiplied) Total For e.g. Brat Sunbather 313.56 Bart Simpson 2528.78 Total: 2842.34 I'm stuck in trying

Use sed to delete a matched regexp and the line (or two) underneath it

谁说胖子不能爱 提交于 2020-01-05 05:29:09
问题 OK I found this question: How do I delete a matching line, the line above and the one below it, using sed? and just spent the last hour trying to write something that will match a string and delete the line containing the string and the line beneath it (or a variant - delete 2 lines beneath it). I feel I'm now typing random strings. Please somebody help me. 回答1: If I've understood that correctly, to delete match line and one line after /matchstr/{N;d;} Match line and two lines after /matchstr