POV-Ray : Newsgroups : povray.binaries.scene-files : mesh creation macros : Re: mesh creation macros Server Time
2 Sep 2024 10:14:09 EDT (-0400)
  Re: mesh creation macros  
From:
Date: 26 Nov 2001 10:05:38
Message: <opj40u8js0ku3s01riap7b9d0v1d71v0kp@4ax.com>
On 17 Nov 2001 08:36:51 -0500, ingo <ing### [at] homenl> wrote:
> Here's some mesh making macros I'd like to have some feedback on. Don't 
> rely too much on them as they are still changing and some depend on the 
> buggy POV-Ray 3.5 splines that also may change.

I played with similiar system like this set of macros. It is supposed to be
standard inlude files for POV 3.5 ?

Here are my propositions:

1. Coons
========

  Change header of Coons macro to:
  #macro Coons(
    Spl1, Min1, Max1,
    Spl2, Min2, Max2,
    Spl3, Min3, Max3,
    Spl4, Min4, Max4,
    Iter_U, Iter_V, FileName)

  and change calculation of P0 to

  #local P0=LInterpolate(
    I,
    <0,0,0>+Spl1(LInterpolate(J,Min1,Max1)),
    <0,0,0>+Spl3(LInterpolate(Jm,Min3,Max3))
  ) + 
  LInterpolate(
    Jm,
    <0,0,0>+Spl2(LInterpolate(I,Min2,Max2)),
    <0,0,0>+Spl4(LInterpolate(Im,Min4,Max4))
  )-C0;

  this way you achive possibility of use smaller number of splines
  old syntax
  #macro Coons_Simple(Spl1, Spl2, Spl3, Spl4, Iter_U, Iter_V, FileName)
      Coons(Spl1,0,1,Spl2,0,1,Spl3,0,1,Spl4,0,1, Iter_U, Iter_V, FileName)
  #end
  new possibilities
  #macro Closed_Surface(Spl, Iter_U, Iter_V, FileName)
    Coons(Spl,0,.25,Spl,.25,.5,Spl,.5,.75,Spl,.75,1,Iter_U,Iter_V,FileName)
  #end

  This way you can simplier control inner behaviour of surface becouse you can
  play with it on grid of splines by evaluating subsets.

2. Makemesh
===========

Macros from Makemesh.inc are IMO designed to be more general than only for other
zipped macros they should allow meshes with no normals and no uvvectors. It
could be for example done this way:

//necessary declarations
#declare Empty_List=array[1];
#macro Make_List(Array) array[1]{Array} #end
// sample usage
BuildWriteMesh2(VecArr, Make_List(NormArr), Empty_List, U, V, FileName)
// changed begining of macros
#macro BuildWriteMesh2(VecArr, NormArr, UVArr, U, V, FileName)
  #local Normals_Defined=(defined(NormArr[0])?yes:no);
  #local UV_Defined=(defined(UVArr[0])?yes:no);
  // rest of macro with reference to normals and uv extended with [0]
#end

Also if it is designed as standard include file I think it shuld be better to
refer to standard Interpolate macro or function adjust_range from math.inc.

> *Make the macros that use splines more general so they can take arrays 
> with points as input. Then provide macros that turn splines, functions 
> etc. into point arrays?

yes.

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

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