POV-Ray : Newsgroups : povray.binaries.images : POVghanistan Revisited! : Re: POVghanistan Revisited! Server Time
29 Apr 2024 00:09:41 EDT (-0400)
  Re: POVghanistan Revisited!  
From: Melody
Date: 24 Nov 2019 20:00:00
Message: <web.5ddb258b6fbb8a6f9da690110@news.povray.org>
> Perhaps too tough for me... I don't have the faintest clue how to
> integrate the output of these functions (i. e. N_vec_Arr[])! Where shall
> I invoke the macro - inside the mesh2 object?

Once you got verts and faces set, just call FastNorms77(1)
It simply defines your Normals. Then you are ready to define a mesh.

OK,so.
you might know NumVertices. if not, you guess at first, or you could make
function to count them.

here we are guessing, later we count and reset NumVertices.
basically stacks*slices, or some known dimensions.
over estimate if guessing, don't under estimate.

initially:
   #declare NumVertices = stacks*slices;

   #declare V_vec_Arr=array[NumVertices]
   #declare N_vec_Arr=array[NumVertices]
   #declare UV_vec_Arr=array[NumVertices]
   #declare NumEdges = 0;
   #declare Edge_Arr=array[NumVertices]
   #declare NumFaces = 0;
   #declare Face_Arr=array[NumVertices*2]
   cr() echof(NumVertices) echo(" Allocated")
(see echo.inc - cr() =carriage return, #debug float, #debug "string")
then you can see your allocated estimate, to see if later it looks too big, etc.

NumFaces might average twice the NumVertices.

legend
V = Vertices
N = Normals
UV = UV (for mapping)

NEXT
Define Vertices
V_vec_Arr[i] = <,,>; // (some 3d point)

NEXT
NumFaces are counted and set, when faces are defined.
<1,2,3> integers in the range of NumVertices

hope this helps,
Melody


Post a reply to this message

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