JTS provides an AffineTransformation class which can do this. It
implements CoordinateSequenceFilter, so can be applied directly to a
geometry.
CodeKaizen wrote:
Greetings -
I think by "rotation" is meant rotation of the axes of the coordinate
system relative to the initial coordinate system. This would rotate
the polygon as well as its extents rectangle. Is this right?
In order to rotate like this, you need to multiply all the coordinates
by a rotation matrix. In JTS, one thing I can think of which would do
this is a GeometryVisitor. However, this would only work for the
polygon. The bounding box would not be rotated, since it assumes the
coordinate system is never rotated. You'd need to convert the bounding
box into a polygon, rotate it, and then use that as the extents of the
rotated polygon. Perhaps you could also subclass Extents to handle
this rotation result.
In NTS (which you've inquired about in the past), the plan is to allow
an affine transformation (which a rotation is a kind of) to be applied
to all coordinates or a set of coordinates, and this would transform
(rotate) everything in that geometry relative to other geometries.
-rory
On Mon, Jun 30, 2008 at 7:55 AM, Sunburned Surveyor
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
wrote:
It would be nice if we could get your name, for starters. Secondly,
your question doesn't really make sense to me.
You wrote: "while I need it rotated to align with the rotated geometry
whihc is a polygon."
How do you establish the rotation or direction of your polygon? This
would make sense if you were talking about a single segment
LineString, or the end points of a multi-segment LineString, but it
doesn't make sense for a Polygon.
I think you need to provide more details on what you are trying to do.
I've got some angle/direction code in JTS Warped that can probably
help you achieve your goal. I don't think the functionality you are
requesting is included as part of the JTS API currently.
The Sunburned Surveyor
On Fri, Jun 27, 2008 at 7:10 PM, <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
> Is there a way in JTS to obtain the bounding box that is rotated at
> specified angle? I see that getEnvelope() and
getEnvelopeInternal() return
> the coordinate extents (minX, minY, maxX, maxY). This gives axis
aligned
> bounding box - while I need it rotated to align with the rotated
geometry
> whihc is a polygon. Any ideas?
>
> Thanks!
>
> ----- Original Message ----
> From: "[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>"
> <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>
> To: [email protected]
<mailto:[email protected]>
> Sent: Friday, June 27, 2008 12:00:18 PM
> Subject: jts-devel Digest, Vol 53, Issue 12
>
> Send jts-devel mailing list submissions to
> [email protected]
<mailto:[email protected]>
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.refractions.net/mailman/listinfo/jts-devel
> or, via email, send a message with subject or body 'help' to
> [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
>
> You can reach the person managing the list at
> [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of jts-devel digest..."
>
>
> Today's Topics:
>
> 1. Name for line intersects (Paul Austin)
> 2. Re: Name for line intersects (Martin Davis)
>
>
>
----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 27 Jun 2008 11:32:49 -0700
> From: "Paul Austin" <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>
> Subject: [jts-devel] Name for line intersects
> To: [email protected]
<mailto:[email protected]>
> Message-ID:
> <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I'm trying to think of a name to describe and intersection
between two
> lines, where the intersection between the two is a line (so it
ignores any
> point intesections). This would be detected using the following.
>
> IntersectionMatrix relate = line1.relate(line2);
> if (relate.get(0, 0) == Dimension.L) {
> return true
> } else {
> return false;
> }
>
> Can anyone think of a catchy name to describe an operator
implementing this?
> Something like intersectsLine.
>
> Cheers,
> Paul
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
>
http://lists.refractions.net/pipermail/jts-devel/attachments/20080627/a138b5d8/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Fri, 27 Jun 2008 11:42:39 -0700
> From: Martin Davis <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>
> Subject: Re: [jts-devel] Name for line intersects
> To: JTS Topology Suite Development
<[email protected]
<mailto:[email protected]>>
> Message-ID: <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> intersectsInALine? intersectsLinearly? intersectsDimension1?
>
> Paul Austin wrote:
>> I'm trying to think of a name to describe and intersection
between two
>> lines, where the intersection between the two is a line (so it
ignores
>> any point intesections). This would be detected using the
following.
>>
>> IntersectionMatrix relate = line1.relate(line2);
>> if (relate.get(0, 0) == Dimension.L) {
>> return true
>> } else {
>> return false;
>> }
>>
>> Can anyone think of a catchy name to describe an operator
implementing
>> this? Something like intersectsLine.
>>
>> Cheers,
>> Paul
>>
------------------------------------------------------------------------
>>
>> _______________________________________________
>> jts-devel mailing list
>> [email protected]
<mailto:[email protected]>
>> http://lists.refractions.net/mailman/listinfo/jts-devel
>>
>
> --
> Martin Davis
> Senior Technical Architect
> Refractions Research, Inc.
> (250) 383-3022
>
>
>
> ------------------------------
>
> _______________________________________________
> jts-devel mailing list
> [email protected]
<mailto:[email protected]>
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>
> End of jts-devel Digest, Vol 53, Issue 12
> *****************************************
>
> _______________________________________________
> jts-devel mailing list
> [email protected]
<mailto:[email protected]>
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
>
_______________________________________________
jts-devel mailing list
[email protected]
<mailto:[email protected]>
http://lists.refractions.net/mailman/listinfo/jts-devel
------------------------------------------------------------------------
_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel
--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022
_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel