Need a Algorithm for Getting the border of a shape

I have a problem...I want a pseudocode..for the following problem

Aim:

I need the lines to be ordered first and then also it should be in anticlockwise directions (if the points are also not ordered for these

ordered lines ..order them too... in anti clockwise direction)

Specification:

I have a vector of lines and arcs to form a shape....

...the lines are not ordered (say for example line 1 followed by 2 ,3 and so

on... but the vector contains lines in random order say 1 3 5 2 4 so

on...please note the vector contains points for the line only and no

identification for the order.)

The lines will combine to form any shape (eg rectangle ..rhombus or any

polygon or shape.) the shape can also contain lines along diagonal too.. or

some lines intersecting the polygon at any of the sides...but within the

boundary

for example..

new java.awt.Point(10, 20));

new java.awt.Point(10, 50)); //line 4

new java.awt.Point(40, 50));

new java.awt.Point(10, 50)); //line 3

new java.awt.Point(40, 50));

new java.awt.Point(40, 20)); //line 1

new java.awt.Point(10, 20));

new java.awt.Point(40, 20)); //line 2

new java.awt.Point(10, 25));

new java.awt.Point(40, 35)); //line 5

new java.awt.Point(40, 25));

new java.awt.Point(10, 45)); //line 6

kindly if any one knows the solution for this or any site which has a

solution for this...please send it or find the solution at the earliest.

Thanking u in advance.

Oliver

[1634 byte] By [oliver_ferns] at [2007-9-26 6:10:17]
# 1

> I have a vector of lines and arcs to form a shape....

What kind of arcs? Conic sections? 3rd degree Bezier curves?

> please note the vector contains points for the line only

So no arcs or lines, just points? Didn't you just say the opposite?

> the shape can also contain lines along diagonal too..

What diagonal?

> or some lines intersecting the polygon at any of the

> sides...but within the boundary

What does that mean?

Maybe we can figure out a proper answer if you describe your problem better...

jsalonen at 2007-7-1 14:59:24 > top of Java-index,Security,Cryptography...
# 2
yeah, do you want the bounding rectangle? or an outline of the shape? use the getBounds method to get the bounding rectangle.
almilli at 2007-7-1 14:59:24 > top of Java-index,Security,Cryptography...
# 3

My problem is I have a shape which can be formed from either arcs or lines or maybe both.This shape can contain lines in the inside ,touching the borders .Basically any combinations of lines or arcs a user can imagine.

A simple example.

__a

|\/|

b| f\/ e| d

|__\|

c

Now say this is the shape and the lines for forming the shape are a,b,c,d,e,f these lines are contained in the vector, but say in random order ex. b,e,f,a,d,c

Now from these vectos I need the lines to be ordered in a sequence like a,b,c,d,e,f but I need the border first, NOTE the lines contain no identification like a,b but the startpoint and endpoints in the vector.

AIM: I need the lines ordered in anticlockwise direction.

Now taking the above diagram the corners could contain arcs instead of the lines intersecting.

oliver_ferns at 2007-7-1 14:59:24 > top of Java-index,Security,Cryptography...