lines

How do I draw lines using XNA?

拈花ヽ惹草 提交于 2019-11-27 19:15:46
I've read a bunch of tutorials involving XNA (and it's various versions) and I still am a little confused on drawing primitives. Everything seems to be really convoluted. Can someone show me, using code, the simplest XNA implementation of drawing one or two lines on to the screen? Perhaps with a brief explanation (including the boilerplate)? I'm not a games programmer and I have little XNA experience. My ultimate goal is to draw some lines onto the screen which I will eventually transform with rotations, etc (by hand). However, for this first step.. I need to simply draw the lines! I remember

Lost code lines when Notepad++ crashed

一曲冷凌霜 提交于 2019-11-27 17:25:50
I was working on a .js file this morning on Notepad++, as usual, when the program just crashed. So I ended it, and re-opened it to see that all my code lines in my .js file, had disappeared, and now all I have left is the file with a size of 0kb because there's nothing left in it. How the hell is that even possible ? It erased everything I typed and saved the file as if there's nothing in it. Do you know a way to get my code back ? Or did something like this ever happened to someone ? :/ I'm kinda worried because there was a lot of work there and I don't feel like re-typing it all... Indrajit

Calculating angle between two points - java

早过忘川 提交于 2019-11-27 16:39:00
问题 I need to calculate the angle in degrees between two points, with a fixed point that is connected with the given two points by a line. Here is an image that illustrates what I need: Here is what I have tried so far: public static float GetAngleOfLineBetweenTwoPoints(float x1, float x2, float y1, float y2) { float xDiff = x2 - x1; float yDiff = y2 - y1; return (float) (Math.atan2(yDiff, xDiff) * (180 / Math.PI)); } It's pointless to say that it doesn't provide the correct answer. 回答1: You can

displaying multiple lines of a file, never repeating

守給你的承諾、 提交于 2019-11-27 16:18:18
i need to, for every ten lines, echo them in a div. example: <div class='return-ed' id='1'> line 1 line 2 ... line 9 line 10 </div> <!-- next group of lines --> <div class='return-ed' id='2'> line 11 line 12 ... line 19 line 20 </div> does anyone know a way to do this? array is from file(), so its lines from a file. Gordon This should work: $blocks = array_chunk(file('path/to/file'), 10); foreach($blocks as $number => $block) { printf('<div id="%d">%s</div>', $number+1, implode('<br/>', $block)); } References: array_chunk() printf() echo '<div class="return-ed" id="1">'; $lineNum = 0; foreach

BufferedReader is skipping every other line when reading my file in java

此生再无相见时 提交于 2019-11-27 16:17:12
So Im working of reading a file containing appointments that I wrote to earlier in my code. I want to sift through the text file and find appointments on a certain date and add them to an ArrayList but when the BufferedReader goes through it, it skips ever other line... Heres my code public ArrayList<String> read(int checkDay, int checkMonth, int checkYear) { ArrayList<String> events = new ArrayList<String>(); BufferedReader in = null; String read; try { in = new BufferedReader(new FileReader("calendar.txt")); while ((read = in.readLine()) != null) { read = in.readLine(); String[] split = read

JFreeChart Scatter Plot Lines

旧街凉风 提交于 2019-11-27 16:15:52
问题 I'm trying to create a graph with JFreeChart, however it doesn't get the lines right. Instead of connecting the points in the order I put them, it connects the points from in order of their x-values. I'm using ChartFactory.createScatterPlot to create the plot and a XYLineAndShapeRenderer to set the lines visible. /edit: sscce: package test; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation;

Inner angle between two lines

你说的曾经没有我的故事 提交于 2019-11-27 14:48:52
问题 I have two lines: Line1 and Line2. Each line is defined by two points (P1L1(x1, y1), P2L1(x2, y2) and P1L1(x1, y1), P2L3(x2, y3)) . I want to know the inner angle defined by these two lines. For do it I calculate the angle of each line with the abscissa: double theta1 = atan(m1) * (180.0 / PI); double theta2 = atan(m2) * (180.0 / PI); After to know the angle I calculate the following: double angle = abs(theta2 - theta1); The problem or doubt that I have is: sometimes I get the correct angle

r - ggplot2: connecting points in polar coordinates with a straight line

痞子三分冷 提交于 2019-11-27 08:02:32
问题 I have a plot in polar coordinates. I used geom_path to connect the points, but I'd like the paths to be straight lines. Here's what I have so far: example <- data.frame(c(5,4,3),c(0.9,1.1,0.6)) colnames(example) <- c("r", "theta") myplot <- ggplot(example, aes(r, theta)) + geom_point(size=3.5) + coord_polar(theta="y", start = 3/2*pi, direction=-1) + scale_x_continuous(breaks=seq(0,max(example$r)), lim=c(0, max(example$r))) + scale_y_continuous(breaks=round(seq(0, 2*pi, by=pi/4),2), expand=c

sorting lines of an enormous file.txt in java

一笑奈何 提交于 2019-11-27 06:16:07
问题 I'm working with a very big text file (755Mb). I need to sort the lines (about 1890000) and then write them back in another file. I already noticed that discussion that has a starting file really similar to mine: Sorting Lines Based on words in them as keys The problem is that i cannot store the lines in a collection in memory because I get a Java Heap Space Exception (even if i expanded it at maximum)..(already tried!) I can't either open it with excel and use the sorting feature because the

Bash continuation lines

痞子三分冷 提交于 2019-11-27 06:13:17
How do you use bash continuation lines? I realize that you can do this: echo "continuation \ lines" >continuation lines However, if you have indented code, it doesn't work out so well: echo "continuation \ lines" >continuation lines This is what you may want $ echo "continuation"\ > "lines" continuation lines If this creates two arguments to echo and you only want one, then let's look at string concatenation. In bash, placing two strings next to each other concatenate: $ echo "continuation""lines" continuationlines So a continuation line without an indent is one way to break up a string: $