lines

Three.js buffergeometry disappears after moving camera to close

孤者浪人 提交于 2019-11-29 14:59:23
My buffergeometry disappears after moving the camera to close. You can also see that in drawcalls Three.js example that has TrackballControls . In my case it's alot worser. My points disappear at the distance from 0 to 400 and my lines disappear at the distance from 0 to 100. My objects are working fine with a simple geometry but not with a buffergeometry. I found out that it has something to do with the centroid of the buffergeometry. I tryed to use different camera's, to change the camera range and still it doesn't work. How can I stop my objects to disappear after moving the camera? Update

Drawing multiple lines in a BufferedImage

限于喜欢 提交于 2019-11-29 13:41:57
I am trying to draw horizontal and vertical lines on a bufferedimage. It should end up looking like a grid of cells. But when I run the code, I see only two lines: the leftmost line and the topmost line (ie. a line from 0,0 to 0,height of image & 0,0 to width of image,0) Heres the code snippet: BufferedImage mazeImage = new BufferedImage(imgDim.width, imgDim.height, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = mazeImage.createGraphics(); g2d.setBackground(Color.WHITE); g2d.fillRect(0, 0, imgDim.width, imgDim.height); g2d.setColor(Color.BLACK); BasicStroke bs = new BasicStroke(2); g2d

Minimal rectangle containing all intersections of lines

余生颓废 提交于 2019-11-29 12:01:53
I'm trying to find an algorithm that will find all the intersections of a set of lines and compute the minimal rectangle that contains all the intersections in O(n log n) time. So far I'm guessing it has to do with duality and convex hulls, but I'm kinda stuck on how it would actually help me solve this problem. If anyone has an idea on this, please let me know. Thanks :) Let's start from a box B[0] that minimally bounds three intersection points in a triangle. If no triangle can be found, then we have a one of the following special cases which can be handled separately: All lines are parallel

read lines in txt file [java]

*爱你&永不变心* 提交于 2019-11-29 08:24:44
I'll try to be as clear as possible but pardon me if my question is not perfect. I have a txt file with several lines of data. example: 123 ralph bose 20000 200 1 2 256 ed shane 30000 100 2 4 ... I need to read each line sequentially and pass it back to a method in a separate class for processing. I know how to break down each line into elements by using StringTokenizer. However, i'm not sure how to read one line at a time, pass back the elements to the other class and then, once the processing is done, to read the NEXT line. Method cooperation between my classes works fine (tested) but how do

Calculating angle between two points - java

岁酱吖の 提交于 2019-11-29 04:04:59
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. You can have the following method that calculates the angle in radians using the Math.atan2 method: public static

JFreeChart Scatter Plot Lines

荒凉一梦 提交于 2019-11-29 01:53:02
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; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org

remove empty lines from text file with PowerShell

核能气质少年 提交于 2019-11-29 01:11:59
I know that I can use: gc c:\FileWithEmptyLines.txt | where {$_ -ne ""} > c:\FileWithNoEmptyLines.txt to remove empty lines. But How I can remove them with '-replace' ? I found a nice one liner here >> http://www.pixelchef.net/remove-empty-lines-file-powershell . Just tested it out with several blanks lines including newlines only as well as lines with just spaces, just tabs, and combinations. (gc file.txt) | ? {$_.trim() -ne "" } | set-content file.txt See the original for some notes about the code. Nice :) This piece of code from Randy Skretka is working fine for me, but I had the problem,

Inner angle between two lines

落花浮王杯 提交于 2019-11-28 23:33:27
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 but sometimes I get the complementary angle (for me outer). How can I know when subtract 180º to know

Finding points on a line with a given distance

蓝咒 提交于 2019-11-28 23:15:53
I have a question i know a line i just know its slope(m) and a point on it A(x,y) How can i calculate the points(actually two of them) on this line with a distance(d) from point A ??? I m asking this for finding intensity of pixels on a line that pass through A(x,y) with a distance .Distance in this case will be number of pixels. I would suggest converting the line to a parametric format instead of point-slope. That is, a parametric function for the line returns points along that line for the value of some parameter t. You can represent the line as a reference point, and a vector representing

Why is this C code faster than this C++ code ? getting biggest line in file

折月煮酒 提交于 2019-11-28 20:59:16
问题 I have two versions of a program that does basically the same thing, getting the biggest length of a line in a file, I have a file with about 8 thousand lines, my code in C is a little bit more primitive (of course!) than the code I have in C++. The C programm takes about 2 seconds to run, while the program in C++ takes 10 seconds to run (same file I am testing with for both cases). But why? I was expecting it to take the same amount of time or a little bit more but not 8 seconds slower! my