Questions tagged [line-segment]

90 questions
1
vote
2 answers

How to find intersections of all line segments built on polygon vertices?

Given convex polygon with known coordinates of vertices. Every pair of vertices is connected by a line segment. Is there efficient algorithm to find intersections of resulting line segments? For example, with regular dodecagon all line segments form…
1
vote
1 answer

Dashed line in plotly::add_segment

Is there a way to use the add_segments() function to create a dashed line? I've tried using linetype, linetypes, line = list(...), dash = "dash" but nothing seems to work. Here is some sample code with a horizontal line. Right now it's just ignoring…
setty
  • 425
  • 3
  • 18
1
vote
1 answer

How to get polygons from connected line segments

I have a list of connected line segments. How to get the polygons. let lines = [ [10, 10, 200, 10], [10, 10, 10, 200], [10, 200, 200, 10], [200, 10, 390, 10], [200, 10, 390, 200], [390, 10, 390, 200], [10, 200, 10, 390], …
mazznoer
  • 103
  • 2
  • 9
1
vote
2 answers

intersection between a line and square

I have a square in 2d space (width = height). The square is currently defined by two points: BottomLeft(X1,Y1) and TopRight(X2,Y2). The square is axis-aligned, so finding the other two corners is as easy as (X1, Y2) and (X2, Y1). I also have two…
Vlad Vyatkin
  • 544
  • 5
  • 16
1
vote
0 answers

Matlab - how to check if line segment intersects axis-aligned square

I'm searching for some efficient matlab code that checks if a line segment intersects a square. The square is axis-aligned, the line segment does not have to be axis aligned. It is a decision procedure, i.e. return Y or N, so I do not require…
1
vote
1 answer

Segmenting handwritten text into lines

I'm attempting to split the handwritten text from a dataset of NIST forms into separate lines. Here is a link to the dataset: https://www.nist.gov/srd/nist-special-database-19 Example Image The code I'm using is based off of a similar question on…
HAL
  • 33
  • 1
  • 5
1
vote
1 answer

Cartesian X, Y create a line giving heading degrees

Trying this again with no luck from the first post. Working on a GPS application and a user will hit a button which with give a GPS point. That GPS point will be converted into Cartesian Coordinates. I will also have the heading in degrees. An…
kfrosty
  • 805
  • 1
  • 8
  • 14
1
vote
3 answers

Shortest distance between a line segement and a point in three dimensions (3D)

I've been building a program in MATLAB off of an excellent thread describing how to find the shortest distance between a point and a line segment in 2D (Shortest distance between a point and a line segment). I need a function that does essentially…
1
vote
1 answer

Why do we need to round when computing x-intercept of horizontal line in Cohen-Sutherland clipping algorithm?

I'm studying computer graphics and came across Cohen-Sutherland line clipping algorithm. Where we have a line segment defined by the points P1 and P2 and we're trying to find out whether it's getting clipped within a clipping rectangle (usually…
vexe
  • 5,433
  • 12
  • 52
  • 81
1
vote
0 answers

Determining if/which sequences of line segments run close to each other on iOS MapKit

This is a bit of a tricky question. It's not as simple (I don't think) as line intersections. First of all, I'm given a bunch of map coordinates in order that define a bus route, and I'm drawing it onto my map (MapKit, iOS) with an MKPolyline. It…
James Linnell
  • 3,804
  • 1
  • 14
  • 6
1
vote
1 answer

Algorithm to find all line segment intersections given n lines

I'm looking for a algorithm to find all the intersection points given n line segments. Below is the pseudo code from http://jeffe.cs.illinois.edu/teaching/373/notes/x06-sweepline.pdf The input S[1 .. n] is an array of line segments. label[i] is the…
1
vote
1 answer

Detecting ball collision with a user-added square

Basically I have been asked to create a pinball game that fires a ball on to a board and the user can control flippers etc to keep the ball from hitting an absorber with added shapes to act as bumpers to keep the ball in play. However, I've run in…
user3410327
  • 79
  • 1
  • 2
  • 8
1
vote
0 answers

Transfering line segments from a plot to another with corresponding points on different coordinates

Due to its nature it is probably unique. So I've a plot (specifically it is a classical MultiDimensional Scaling plot). Typically, I have a data frame imported in R but, I will use randomly generated data here so this is the script to get my MDS:…
1
vote
1 answer

Very general question about the implementation of vectors, vertices, edges, rays, lines & line segments

This is just a LARGE generalized question regarding rays (and/or line segments or edges etc) and their place in a software rendered 3d engine that is/not performing raytracing operations. I'm learning the basics and I'm the first to admit that I…
Gary Paluk
  • 1,038
  • 1
  • 14
  • 28
1
vote
3 answers

Trying to figure out if two line segments intersect

I have a line segment made of two points p1 and p2, and a second line segment made up of points p3 and p4. I'm trying to figure out if they intersect, and so far, I have had no luck. This is my code so far: public static double angle(Point p1, Point…
user2885503
  • 25
  • 1
  • 11