Search tables with colors in VTK

Source: Internet
Author: User

The method for searching a table is

1. Read the scalar or to the most, and store it with a vtkfloatarray. The scalar in it can represent different colors.

2. Create a search table, use setnuberofcolors () to allocate space, assign values, and use build () to create a search table.

3. Combine the scalar array with the vtkfloatarray and the polygon, and combine the lookup table with the vtkmapper.

 

Note: The float type is used for table search.

 

DetailsCodeAs follows:

 

M_abstractreader-> setfile (); // connects to the media transcoding queue.

 
 

Mypoints-> insertnextpoint (0.0, 0.0, 0.0 );
For (int kk = 0; KK <m_javasactreader-> numnode; KK ++)
{
Mypoints-> insertnextpoint (m_javasactreader-> node [Kk] [0], m_javasactreader-> node [Kk] [1], m_javasactreader-> node [Kk] [2]);
}

Mygrid-> setpoints (mypoints );
Mygrid-> allocate (2000,100 0 );///////////
 

For (int kkk = 0; KKK <m_javasactreader-> numele; KKK ++)
{

Mygrid-> insertnextcell (12, 8, m_javasactreader-> ele [KKK]);
}

//// // Sets the Vector

Myarray-> setnumberoftuples (m_abstractreader-> numele );
For (INT Mmm = 0; Mmm <m_abstractreader-> numele; Mmm ++)
{
Myarray-> inserttuple (MMM, & m_abstractreader-> VEC [Mmm]);
}

Mygrid-> getcelldata ()-> setscalars (myarray );

 

Mytable-> setnumberofcolors (9 );
Mytable-> settablerange (0, 8 );
Mytable-> settablevalue (0, 1.0, 0.0, 0.0 );

Mytable-> settablevalue (1, 0.0, 1.0, 0.0 );
Mytable-> settablevalue (2, 0.0, 0.0, 1.0 );
Mytable-> settablevalue (3, 1.0, 1.0, 0.0 );

Mytable-> settablevalue (4, 0.0, 1.0, 1.0 );
Mytable-> settablevalue (5, 1.0, 0.0, 1.0 );
Mytable-> settablevalue (6, 0.5, 2.0, 0.8 );

Mytable-> settablevalue (7, 1.0, 0.0, 0.0 );
Mytable-> settablevalue (8, 1.0, 0.4, 0.5 );
Mytable-> build ();

Filter-> setinput (mygrid );

//// // Entity painting

 

Normals-> setinputconnection (filter-> getoutputport ());
Normals-> flipnormalson ();
Normals-> setflipnormals (1 );

Conemapper-> setinputconnection (Normals-> getoutputport ());

/// // Use the lookup table
Conemapper-> setscalarmodetousecelldata ();
Conemapper-> uselookuptablescalarrangeon ();
Conemapper-> setlookuptable (mytable );
//////////////////////////////////////// ////////////////////

 

//////////// Wiredrawing /////////////////////// ////////////

Normalswire-> setinputconnection (filter-> getoutputport ());
Normalswire-> flipnormalson ();
Normalswire-> setflipnormals (1 );

 

Actormapper-> setinputconnection (normalswire-> getoutputport ());
Actormapper-> setresolvecoincidenttopologytopolygonoffset ();

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.