POV-Ray : Newsgroups : povray.binaries.images : Creating C# Mesh components Server Time
15 Nov 2024 08:23:29 EST (-0500)
  Creating C# Mesh components (Message 1 to 1 of 1)  
From: Bryan Valencia
Subject: Creating C# Mesh components
Date: 10 Jul 2008 23:12:52
Message: <4876cfb4@news.povray.org>
I have been working on a C# library so I can write mesh editing software... Here is a
(very early) test output.


This was generated with a simple loop in C# and the components themselves generate the
mesh2 object...

Here's a C# snippet from my test app.  I wrote a function named "Function" that
returns a mathematical y value for any x 
and z)..  The resultant mesh is 19K lines of text, 12800 faces (triangles) and 6561
vertices.  It automatically re-uses 
identical vertices.

There are no Normals or UV Mapping yet, and I have no clue what might happen if there
were groups nested inside each other.

The fun bit is that I can get the POV output for any object from this one line of
code...

    string POV = a_thing.toPOV();

----------


             BV3D.group a_thing = new BV3D.group("A Test Thing");


             int J = 40;
             for (int x = -J; x < J; x++)
             {
                 for (int z = -J; z < J; z++)
                 {
                     {
                         BV3D.triangle t = new BV3D.triangle();
                         t.A.setVector(x, Function(x,z), z);
                         t.B.setVector(x + 1, Function(x+1, z), z);
                         t.C.setVector(x + 1, Function(x+1, z+1), z + 1);

                         a_thing.triangles.Add(t);
                     }

                     {
                         BV3D.triangle t = new BV3D.triangle();
                         t.A.setVector(x, Function(x, z), z);
                         t.B.setVector(x, Function(x, z+1), z + 1);
                         t.C.setVector(x + 1, Function(x+1, z+1), z + 1);

                         a_thing.triangles.Add(t);
                     }

                 }
             }
             string POV = a_thing.toPOV();


Post a reply to this message


Attachments:
Download 'mest2test.jpg' (35 KB)

Preview of image 'mest2test.jpg'
mest2test.jpg


 

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