POV-Ray : Newsgroups : povray.programming : I have some external OOP interface for povray. : Re: I have some external OOP interface for povray. Server Time
1 Jul 2024 03:18:14 EDT (-0400)
  Re: I have some external OOP interface for povray.  
From: ABX
Date: 28 Apr 2004 10:34:39
Message: <s9fv80lihsserosev6uibg0jg6ps2gj89a@4ax.com>
On 28 Apr 2004 09:50:38 -0400, Warp <war### [at] tagpovrayorg> wrote:
> > The main disadvantage of your system to me seems you don't have access 
> > to the internal functions of POV-Ray which otherwise are very important 
> > for creating scenes.
>
> That's true. For instance being able to call trace() or inside() is
> pretty handy sometimes. I don't see any easy way of doing the same
> with a C++ frontend (at least not without a lot of work).

Something like below (not perfect at all) workaround comes to my mind:

bool Inside(Object& obj,Vector& V)
{
  Frame temp_frame("c:\\temp\\temp_file.pov");

  temp_frame << "#declare Object =";
  temp_frame << obj;
  temp_frame << ";\n\n";

  temp_frame << "#declare Vector =";
  temp_frame << V;
  temp_frame << ";\n\n";

  temp_frame << "#declare is_inside = inside( Object , Vector );\n\n";

  temp_frame << "#fopen MyFile \"c:\\temp\\temp_file.out\" write";
  temp_frame << "#write (MyFile,is_inside)";
  temp_frame << "#fclose MyFile";

  temp_frame.render();

  FILE *temp_file = fopen ("c:\\temp\\temp_file.out" , "r"); 
  int is_inside = fgetc(temp_file);
  fclose(temp_file);

  return is_inside == '1';
}

ABX


Post a reply to this message

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