Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8566467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:39:39+00:00 2026-06-11T17:39:39+00:00

I have a 3D datastructure in C code that I want to visualize as

  • 0

I have a 3D datastructure in C code that I want to visualize as boxes and points in 3D space. So I have a bunch of coordinates, some for points and some for boxes and I want to plot these in 3D to visualize the data structure. Anyone have experience doing anything similar to this? I started trying to use paraview. My plan being to generate a paraview statefile (xml-type file) and then just open it with paraview. The problem is those state files are massive and complex. To try and figure out the xml structure I was creating Boxes and Point sources in paraview and then looking at the state files it generated. It looks awful.

I just want to be able to say display a box with these coordinates and a point with these coordinates in a minimalistic way. Anyone have any ideas? Doesn’t have to be in C or paraview necessarily as I can output the coordinates and input in whatever to generate the final product. Python + Matlab would work just as well if it works.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:39:41+00:00Added an answer on June 11, 2026 at 5:39 pm

    So I figured out a nice compromise. I started with the git code as described here:

    http://www.shocksolution.com/microfluidics-and-biotechnology/visualization/python-vtk-paraview/

    It’s only one python file. The gist is the code there lets you give x,y,z positions and radius for points and outputs an XML file that is in VTK format. So to do the particles I just hand it the x,y,z positions and then a constant for the radius for all particles. Then I just make a spherical glyph on the datasets.

    For the boxes I use the exact same code. For each box I still output x,y,z coordinates where the x,y,z values are the coordinates of the center of the box. Then for the “radius” parameter I use the edge length of the cube. This works because again in paraview I just glyph the datapoints for the boxes. I use the box glyph, and scale by scalar where the scalar is the radius. If you don’t orient the box glyphs and set the scalar factor to 1 you get the desired result. Here’s a simple example with everything uniform:

    Simple Uniform Tree

    So I just output the coordinates in my C datastructure to CSV files and then in python pull in the files and use the code at the link and open the result with paraview. Here’s how I used the code at the link:

    from vtktools import VTK_XML_Serial_Unstructured
    import sys
    
    if len(sys.argv) > 2:
        treeFile = sys.argv[1]
        bodyFile = sys.argv[2]
    else:
        print 'No input files'
        exit(4)
    
    x = []
    y = []
    z = []
    r = []
    
    f = open(treeFile, 'r')
    for line in f:
        v = line.split(',')
        x.append(float(v[0].strip()))
        y.append(float(v[1].strip()))
        z.append(float(v[2].strip()))
        r.append(float(v[3].strip()))
    f.close()
    
    temp = treeFile.split('/')
    if (len(temp) == 1):
        temp = temp[0]
    else:
        temp = temp[-1]
    tree_writer = VTK_XML_Serial_Unstructured()
    tree_writer.snapshot(temp.split('.',1)[0] + '.vtu', x, y, z, [], [], [], [], [], [], r)
    tree_writer.writePVD("octree.pvd")
    x = []
    y = []
    z = []
    r = []
    
    f = open(bodyFile, 'r')
    for line in f:
        v = line.split(',')
        x.append(float(v[0].strip()))
        y.append(float(v[1].strip()))
        z.append(float(v[2].strip()))
        r.append(float(v[3].strip()))
    f.close()
    
    temp = bodyFile.split('/')
    if (len(temp) == 1):
        temp = temp[0]
    else:
        temp = temp[-1]
    body_writer = VTK_XML_Serial_Unstructured()
    body_writer.snapshot(temp.split('.',1)[0] + '.vtu', x, y, z, [], [], [], [], [], [], r)
    body_writer.writePVD("distribution.pvd")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data stored in a DB that I want to process. DB
i have some functions(charfreq,wordfreq,charcount,wordcount,parerror) and i want to use it in dataStructure with the
I have a data structure in my C++ program that has some attributes of
I have a data structure that I want to access / modify in different
I have some code that reads a file into an array of lines, and
I want to write a Parser that produces some data structure and validates its
So, given that I have some type of data structure like this within a
I have a datastructure with a field of the float-type. A collection of these
I have a hierarchical datastructure in Django, and want to match the path to
I use GLib to parse some command-line options. The problem is that I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.