Difference between revisions of "User:Le Forgeron/UVMeshable"

From POV-Wiki
Jump to navigation Jump to search
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{User:Le_Forgeron/HgPovray38/soon}}
+
{{User:Le_Forgeron/HgPovray38/available}}
  
 
== UVMeshable ==
 
== UVMeshable ==
Line 10: Line 10:
 
{
 
{
 
public:
 
public:
   virtual void evalVertex( VECTOR r, const DBL u, const DBL v )const;
+
   virtual void evalVertex( Vector3d& r, const DBL u, const DBL v )const;
   virtual void evalNormal( VECTOR r, const DBL u, const DBL v )const;
+
   virtual void evalNormal( Vector3d& r, const DBL u, const DBL v )const;
   virtual void minUV( UV_VECT r )const;
+
   virtual void minUV( Vector2d& r )const;
   virtual void maxUV( UV_VECT r )const;
+
   virtual void maxUV( Vector2d& r )const;
 
};
 
};
 
</source>
 
</source>
Line 21: Line 21:
 
* <code>nurbs</code> (see [[User:Le_Forgeron/nurbs]])
 
* <code>nurbs</code> (see [[User:Le_Forgeron/nurbs]])
 
* <code>rational_bezier_patch</code> (see [[User:Le_Forgeron/rational_bezier_patch]])
 
* <code>rational_bezier_patch</code> (see [[User:Le_Forgeron/rational_bezier_patch]])
* <code>sphere</code> as a proof of concept
+
* <code>sphere</code>
 +
* <code>cone</code>
 +
* <code>cylinder</code>
 +
* <code>ovus</code>
 +
* <code>lemon</code>
 +
* <code>torus</code>
 +
* <code>disc</code>
 +
* <code>parametric</code>
  
 
=== Access to data of UVMeshable objects ===
 
=== Access to data of UVMeshable objects ===
Line 29: Line 36:
 
* Returns the vertex vector that corresponds to the given uv-coordinates '''uv_vertex( UVMeshableObject, Ucoordinate, Vcoordinate )'''
 
* Returns the vertex vector that corresponds to the given uv-coordinates '''uv_vertex( UVMeshableObject, Ucoordinate, Vcoordinate )'''
 
* Returns the normal vector that corresponds to the given uv-coordinates '''uv_normal( UVMeshableObject, Ucoordinate, Vcoordinate )'''
 
* Returns the normal vector that corresponds to the given uv-coordinates '''uv_normal( UVMeshableObject, Ucoordinate, Vcoordinate )'''
 +
 +
=== Turning UVMeshable into mesh ===
 +
 +
<source lang="pov">
 +
#include "NurbsMesh.inc"
 +
#declare UResolution = 92;
 +
#declare VResolution = 92;
 +
mesh {
 +
    UVMeshable( UVMeshableObject, UResolution, VResolution )
 +
    }
 +
</source>
 +
<gallery>
 +
image:LeForgeronUVMeshableCone.png
 +
image:LeForgeronUVMeshableCylinder.png
 +
image:LeForgeronUVMeshableLemon.png
 +
image:LeForgeronUVMeshableOvus.png
 +
image:LeForgeronUVMeshableSphere.png
 +
image:LeForgeronUVMeshableTorus.png
 +
image:LeForgeronUVMeshableParametric.png
 +
</gallery>
 +
 +
[[Image:LeForgeronUVMeshableMany.png]]

Latest revision as of 16:40, 14 June 2020

UVMeshable

A bit of programming

UVMeshable objects are shapes that provides the UVMeshable interface:

class UVMeshable
{
public:
  virtual void evalVertex( Vector3d& r, const DBL u, const DBL v )const;
  virtual void evalNormal( Vector3d& r, const DBL u, const DBL v )const;
  virtual void minUV( Vector2d& r )const;
  virtual void maxUV( Vector2d& r )const;
};

Which shapes are UVMeshable

So far the following shapes are UVMeshable:

Access to data of UVMeshable objects

  • Returns the minimal uv-coordinates uv_min( UVMeshableObject )
  • Returns the maximal uv-coordinates uv_max( UVMeshableObject )
  • Returns the vertex vector that corresponds to the given uv-coordinates uv_vertex( UVMeshableObject, Ucoordinate, Vcoordinate )
  • Returns the normal vector that corresponds to the given uv-coordinates uv_normal( UVMeshableObject, Ucoordinate, Vcoordinate )

Turning UVMeshable into mesh

#include "NurbsMesh.inc"
#declare UResolution = 92;
#declare VResolution = 92;
mesh {
     UVMeshable( UVMeshableObject, UResolution, VResolution )
     }

LeForgeronUVMeshableMany.png