The length of a line intersecting a rectangle - not just diagonal

  • Context: Undergrad 
  • Thread starter Thread starter renucrew
  • Start date Start date
  • Tags Tags
    Length Line Rectangle
Click For Summary

Discussion Overview

The discussion revolves around finding the length of a line segment that intersects a rectangle, specifically within the context of a linear equation and the rectangle's extents. The scope includes mathematical reasoning and potential algorithmic approaches, with considerations for simplifying assumptions about the rectangle's orientation.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested, Mathematical reasoning

Main Points Raised

  • One participant suggests that determining the length of the line segment within the rectangle may require multiple conditional statements to check for intersections with each side of the rectangle.
  • Another participant proposes simplifying the problem by restricting the rectangles to those aligned with the x- and y-axes, providing specific bounds for the rectangle.
  • A different viewpoint suggests that if the rectangle is centered at the origin, the problem may become easier to solve by adjusting the line's intercept and gradient accordingly.
  • One participant introduces the idea of considering the rectangle as a line section in the complex plane, questioning if this perspective could be beneficial.
  • Another participant emphasizes that the surface of the rectangle is not analytic-continuous or differentiable, indicating that multiple tests are necessary rather than a single generic test.
  • One participant expresses frustration at finding only algorithmic solutions and seeks a mathematical expression that could be applied in various analyses.

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on a specific method for calculating the length of the line segment within the rectangle, with multiple competing views and approaches being presented.

Contextual Notes

There are limitations related to the assumptions made about the rectangle's orientation and position, as well as the mathematical properties of the surfaces involved in the discussion.

renucrew
Messages
6
Reaction score
0
Hi

Given a simple linear equation and the extents of a rectangle, is there a neat way of finding the length of the line section that is contained within the rectangle?

The only general method i can think of would involve a bunch of conditional statements to determine whether the line intersects each side of the rectangle.

 
Physics news on Phys.org
renucrew said:
Hi

Given a simple linear equation and the extents of a rectangle,
is there a neat way of finding the length of the line section
that is contained within the rectangle?

Would you allow that the rectangles only be those that
are parallel to the x- and y-axes to simplify the problem?

Example:


A rectangle bounded by:

x = a

x = b

y = c

y = d


And the line could be:

y = mx + f **



I do not want to use "e," as it used for a constant.
 
checkitagain said:
Example:


A rectangle bounded by:

x = a

x = b

y = c

y = d


And the line could be:

y = mx + f **



I do not want to use "e," as it used for a constant.

Hi there, yes i simplified the problem so that one vertex of the rectangle is at the origin and the extents are positive; the length of any line intersecting any rectangle could then be solved by just adjusting the line intercept and gradient to account for the position and orientation if the rectangle is not at the origin or is rotated.

Actually perhaps it would be easier to assume the rectangle is centered at the origin instead.
 
Maybe considering the rectangle to be a line section in the complex plane could help!??!
 
Thanks,

Yeah its just normal Cartesian system. Yeah I've looked and only found algorithmic solutions. I think I am probably being stupid, but I was after a mathematical expression that could used in various analyses.
 
Hey renucrew and welcome to the forums.

Because the surface/volume/whatever you are talking about is not analytic-continuous/differentiable over the whole surface, you have to do multiple tests instead of one generic test.

As a case of where you could do this, something like a sphere or an ellipse could be used as a single test because it has the required properties, but unfortunately you can't do this with your rectangle.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
8K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 24 ·
Replies
24
Views
4K
  • · Replies 73 ·
3
Replies
73
Views
8K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 33 ·
2
Replies
33
Views
4K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K