Thread: liniting values of a custom coordinate

  1. #1
    Registered Abuser
    Join Date
    Sep 2007
    Location
    USA/NJ/TRENTON
    Posts
    127

    liniting values of a custom coordinate

    I'm trying to create a coordinate system for a half-sphere object.

    The values need to range (in degrees) from -90 to positive 90 both horizontally and vertically.

    Creating this coordinate scheme is no real challenge, but I'd like to define a coordinate object that won't allow for values outside of my range:

    -90.0000 <= x <= 90.0000


    Any thoughts how to go about this? Any disadvantages to this approach (creating this kind of object?)

  2. #2
    Registered Abuser
    Join Date
    Sep 2007
    Location
    USA/NJ/TRENTON
    Posts
    127
    ok, i guess it's pretty inefficient to create another object just to limit the values so uhh nevermind.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Having a class to enforce usage of something [e.g. a range] is definitely a valid use. But of course, it does depend on circumstances.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    A library that would do exactly that is currently under discussion on the Boost mailing list. If things go quickly, it could be accepted around new year.
    Of course, that would mean it would be in an actual release around summer 2008, so don't hold your breath. But the use case is definitely valid.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 11-19-2008, 02:36 PM
  2. need some advice on displaying values
    By rEtard in forum Windows Programming
    Replies: 7
    Last Post: 06-16-2005, 09:55 AM
  3. Computing Large Values
    By swbluto in forum C++ Programming
    Replies: 8
    Last Post: 04-07-2005, 03:04 AM
  4. can't assign proper values to an array of string
    By Duo in forum C Programming
    Replies: 1
    Last Post: 04-04-2005, 06:30 AM
  5. Replies: 1
    Last Post: 02-03-2005, 03:33 AM