POV-Ray : Newsgroups : povray.advanced-users : collision detection : Re: collision detection Server Time
30 Jul 2024 00:22:05 EDT (-0400)
  Re: collision detection  
From: Chris Huff
Date: 22 Feb 2001 12:38:34
Message: <chrishuff-3E6D98.12373922022001@news.povray.org>
In article <3A953C06.F7A4B59D@gmx.de>, Christoph Hormann 
<chr### [at] gmxde> wrote:

> (maybe it would be a good idea to make the Inside_Object()
> function available in POV script just like trace()).

I haven't done it before, since this macro is pretty easy:
#macro InObj(Pt, Obj) eval_pattern(object {Obj}, Pt) #end

But all it should take is adding a "inside_object" token to parse.h and 
tokenize.c, and adding this case to Parse_Num_Factor() in express.c 
(make sure you put it with the float functions):
          case INSIDE_OBJECT_TOKEN:
          {
            OBJECT * Object; 
            VECTOR Point;

            GET(LEFT_PAREN_TOKEN);
            Parse_Vector(Point);
            Parse_Comma();
            EXPECT
                CASE(OBJECT_ID_TOKEN)
                    Object = Token.Data;
                    EXIT
                END_CASE
                OTHERWISE
                    Object = NULL;
                    UNGET
                    EXIT
                END_CASE
            END_EXPECT
            if(Object == NULL)
            {   Error ("Object Identifier Expected.");}
            GET(RIGHT_PAREN_TOKEN);
            
            Val = Inside_Object(Point, Object);
          }
          break;

I haven't tested this patch (I haven't even compiled it), but it should 
work.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.