Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #19139 > unrolled thread
| Started by | bob smith <bob@coolfone.comze.com> |
|---|---|
| First post | 2012-10-05 12:00 -0700 |
| Last post | 2012-10-05 15:43 -0400 |
| Articles | 5 — 4 participants |
Back to article view | Back to comp.lang.java.programmer
rectangle contains point bob smith <bob@coolfone.comze.com> - 2012-10-05 12:00 -0700
Re: rectangle contains point markspace <-@.> - 2012-10-05 12:20 -0700
Re: rectangle contains point Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-10-05 15:23 -0400
Re: rectangle contains point bob smith <bob@coolfone.comze.com> - 2012-10-05 14:16 -0700
Re: rectangle contains point Jeff Higgins <jeff@invalid.invalid> - 2012-10-05 15:43 -0400
| From | bob smith <bob@coolfone.comze.com> |
|---|---|
| Date | 2012-10-05 12:00 -0700 |
| Subject | rectangle contains point |
| Message-ID | <ae6e3b64-41bf-40c9-9197-1097c164033b@googlegroups.com> |
So, I have a rectangle class as follows:
public class My_Rectangle {
double x, y, width, height;
AffineTransform aft;
Anyone know a good strategy for checking if a point is in the rectangle?
The main difficulty is the transform.
[toc] | [next] | [standalone]
| From | markspace <-@.> |
|---|---|
| Date | 2012-10-05 12:20 -0700 |
| Message-ID | <k4nbtq$kvr$1@dont-email.me> |
| In reply to | #19139 |
On 10/5/2012 12:00 PM, bob smith wrote:
> So, I have a rectangle class as follows:
>
> public class My_Rectangle {
> double x, y, width, height;
> AffineTransform aft;
>
> Anyone know a good strategy for checking if a point is in the rectangle?
>
> The main difficulty is the transform.
http://lmgtfy.com/?q=computational+geometery
Seriously, it's a big subject. I don't have any easy answers.
[toc] | [prev] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2012-10-05 15:23 -0400 |
| Message-ID | <k4nc36$n46$1@dont-email.me> |
| In reply to | #19139 |
On 10/5/2012 3:00 PM, bob smith wrote:
> So, I have a rectangle class as follows:
>
> public class My_Rectangle {
> double x, y, width, height;
> AffineTransform aft;
>
> Anyone know a good strategy for checking if a point is in the rectangle?
>
> The main difficulty is the transform.
I'll assume that x/y/width/height represent an untransformed
rectangle, and that you want to test whether the point is inside
the quadrilateral formed by transforming the rectangle with aft.
If that's the question, I see two approaches:
- Transform the rectangle and represent the result as a
Polygon, then use Polygon's contains() method.
- Inverse-transform the point and test whether the transformed
point is inside the original rectangle.
If that's not the question, please explain more fully.
--
Eric Sosman
esosman@comcast-dot-net.invalid
[toc] | [prev] | [next] | [standalone]
| From | bob smith <bob@coolfone.comze.com> |
|---|---|
| Date | 2012-10-05 14:16 -0700 |
| Message-ID | <f4f3eda8-4c48-4ab3-b777-5dc5d2e5940b@googlegroups.com> |
| In reply to | #19143 |
On Friday, October 5, 2012 2:23:18 PM UTC-5, Eric Sosman wrote:
> On 10/5/2012 3:00 PM, bob smith wrote:
>
> > So, I have a rectangle class as follows:
>
> >
>
> > public class My_Rectangle {
>
> > double x, y, width, height;
>
> > AffineTransform aft;
>
> >
>
> > Anyone know a good strategy for checking if a point is in the rectangle?
>
> >
>
> > The main difficulty is the transform.
>
>
>
> I'll assume that x/y/width/height represent an untransformed
>
> rectangle, and that you want to test whether the point is inside
>
> the quadrilateral formed by transforming the rectangle with aft.
>
> If that's the question, I see two approaches:
>
>
>
> - Transform the rectangle and represent the result as a
>
> Polygon, then use Polygon's contains() method.
>
>
>
> - Inverse-transform the point and test whether the transformed
>
> point is inside the original rectangle.
>
>
>
> If that's not the question, please explain more fully.
>
>
>
> --
>
> Eric Sosman
>
> esosman@comcast-dot-net.invalid
Excellent ideas. I went with inverse transform, and it works.
Thanks.
[toc] | [prev] | [next] | [standalone]
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Date | 2012-10-05 15:43 -0400 |
| Message-ID | <k4ncuf$scl$1@dont-email.me> |
| In reply to | #19139 |
On 10/05/2012 03:00 PM, bob smith wrote:
> So, I have a rectangle class as follows:
>
> public class My_Rectangle {
> double x, y, width, height;
> AffineTransform aft;
>
> Anyone know a good strategy for checking if a point is in the rectangle?
>
> The main difficulty is the transform.
John B. Matthews provided a strategy for this
in a reply to another of your recent posts.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web