• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[OT] Re: Need guidance on data structure
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OT] Re: Need guidance on data structure


  • Subject: [OT] Re: Need guidance on data structure
  • From: Alastair Houghton <email@hidden>
  • Date: Tue, 28 Apr 2009 21:27:25 +0100

On 28 Apr 2009, at 02:47, Graham Cox wrote:

Because of the cyclic nature of the network though, there isn't a way I can see to simply sort the objects into the right order.

I snipped most of the above; anyone who cares to read it should refer to the original message.


I think the crux of the problem here is that a road can be both child and parent in the same relationship, or child and grandparent and so on. This happens because you're allowing arbitrary interconnection, and the child-parent relationship is important because of the colouring issue that you mention (i.e. the parent road's colour should dominate at junctions).

So the question is what to do about all of this.

I *think* the answer might be as follows:

1. Draw *all* the casements (I'm assuming they're the same colour here; if not, you might need to do step 2 first to break the casements up as well).

2. For each road, break it into segments such that each segment has no more than one junction with other roads. So e.g.

          (C)
           |
      (A)==+================(B)
           |
    (E)====+=====(F)
           |
          (D)

you would break road CD between the AB-CD junction and the EF-CD junction.

   You might have fun handling more complex junctions...

3. Now each road segment only has one junction, so you can sort the segments into the correct rendering order using a topographic sort routine, then simply draw their strokes in that order.

Kind regards,

Alastair.

--
http://alastairs-place.net




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Need guidance on data structure (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Cocoa-dev Digest, Vol 6, Issue 641
  • Next by Date: Re: C string constant->NSString constant without defining twice?
  • Previous by thread: Re: Need guidance on data structure
  • Next by thread: Re: Need guidance on data structure
  • Index(es):
    • Date
    • Thread