3D chart with Mesh surface


Author
Message
mouloud djamah
mouloud djamah
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 5, Visits: 48
Using 3d chart with mesh surface, can I generate graphics like these : https://www.nevron.com/forum/uploads/images/a0caf7c0-b798-484f-8ac7-e7f1.png 
Replies
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi Mouloud,

Yes - you can generate the attached images with the mesh surface series.



Best Regards,
Nevron Support Team


mouloud djamah
mouloud djamah
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 5, Visits: 48
It is easy to make mesh surface (with NChartConrol component) from the data (x, y and z values). But here we have shapes (cylinder and more complicate shapes) . Are there a predefined functions that allow generating the data (x, y, z values) associated to the specific shape (for example cylinder). In general are there (in nevron) a tools or functions that make easy generating graphics like these.    
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Mouloud,

In general Nevron Chart is not a 3D modelling software so it does not have predefined methods to get the xyz mesh of shapes. We can send you code for the generation of simple shapes (cylinder, cone, torus etc.) if you wish.

Best Regards,
Nevron Support Team


mouloud djamah
mouloud djamah
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 5, Visits: 48
Yes send me the code
Thanks
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Mouloud,

The following code shows how to generate the vertices of a cylinder for example:

  internal static void CreateCylinderY(GLDevice device, NSurface surface, int m, int n, float radiusX, float radiusZ, float minY, float maxY, float cx, float cz)
  {
   float angleStep = (float)(NMath.PI2 / (m - 1));
   NVector3DF v3 = NVector3DF.Zero;
   NVector4DF[] arrPrecomputedData = device.RequestPrecompData4F(m);

   int vertexCount = m * n;

   NVertex.P3N[] vertices = device.RequestBufferP3N(vertexCount);

   int lastM = m - 1;

   for (int i = 0; i < lastM; i++)
   {
    // calculate the current angle, its cos and sin
    float alpha = i * angleStep;
    double cosA = Math.Cos(alpha);
    double sinA = Math.Sin(alpha);

    // this is needed for the normal calculation
    double nx = radiusZ * cosA;
    double nz = radiusX * sinA;
    double len = Math.Sqrt(nx * nx + nz * nz);

    // calculate position
    arrPrecomputedData[i].X = (float)(radiusX * cosA);
    arrPrecomputedData[i].Y = (float)(radiusZ * sinA);

    // normalize the normal vector
    if (len > 0.00001)
    {
     arrPrecomputedData[i].Z = (float)(nx / len);
     arrPrecomputedData[i].W = (float)(nz / len);
    }
    else
    {
     arrPrecomputedData[i].Z = (float)cosA;
     arrPrecomputedData[i].W = (float)sinA;
    }
   }

   arrPrecomputedData[lastM] = arrPrecomputedData[0];

   float sizeY = maxY - minY;
   float cellSizeY = sizeY / (n - 1);
   int vertexIndex = 0;

   for (int j = 0; j < n; j++)
   {
    float y = minY + j * cellSizeY;

    for (int i = 0; i < m; i++)
    {
     // set normal
     v3.X = arrPrecomputedData[i].Z;
     v3.Y = 0;
     v3.Z = arrPrecomputedData[i].W;
     vertices[vertexIndex].N = v3;

     // set position
     v3.X = cx + arrPrecomputedData[i].X;
     v3.Y = y;
     v3.Z = cz + arrPrecomputedData[i].Y;
     vertices[vertexIndex].P = v3;

     vertexIndex++;
    }
   }




Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search