Devam Ediyor

Simple Region Adjacency C Code

I need someone to write a program to read a set of regions, and then report for each region, which other regions are adjacent to [url removed, login to view] regions are adjacent if any edge of one intersects with any edge of the other in more than one point.

Input is a file of text defining a set of regions. Each region is a set of polygons. Each polygon is a sequence of points, defining a closed area.

A region starts with a left brace "{", followed by the name of the region, a comma, and then a comma-separated list of polygons, followed by a right brace. For example: { R1, polygon } or { R 2, polygon1, polygon2 }

A polygon is a left square bracket "[" followed by a list of comma-separated points, followed by a right square bracket "]". For example, [ point, point, point ]

A point is an x,y pair, expressed as a left parenthesis "(" followed by two comma separated numbers, followed by a right parenthesis ")". For example, ( [url removed, login to view], -2.0 )

Ignore spaces and line breaks.

A simple set of 3 regions, each region being one polygon is:

An example:

{ Region1, [ (0,1), (0,2), (2,2), (2,1), (0,1) ]}

{ Region2, [ (1,0), (3,0), (3,1), (1,1), (1,0) ]}

{ Region3, [ (3,0), (3,1), (4.1,1), (4.1,0), (3,0) ]}

The output would be:

Region1: Region2

Region2: Region1, Region3

Region3: Region2

If the input is badly formed, simply report: "Bad input at line %d", giving the line number where the input does not match the expected input format.

Thank you

Beceriler: C Programlama

Daha fazlasını görün: pair programming, pair points, pair line, line intersects, intersects line, read example, programming input output, bad programming, c r, region code, program region, code format numbers, polygon area, write simple report, point polygon, simple polygon, format simple report, region, simple program output number, text report input output, polygons, polygon point, list polygons, area polygon, simple read file example

İşveren Hakkında:
( 1 değerlendirme ) waco, United States

Proje NO: #4441256



Hi, I have 6+ year experience with C. I can do this for you.

1 gün içinde 35$ USD
(0 Değerlendirme)