CPlusPlus
vtkActor GetCenter Return Center Of Bounding Box
The interface GetCenter gives us the center of bounding box rather than barycenter of model. Here is source code from VTK9.2.0.
The interface GetCenter gives us the center of bounding box rather than barycenter of model. Here is source code from VTK9.2.0.
If you are on linux os, you needn’t add library setting in CMakeLists.txt. The libray iconv files has been inside system path. main.cpp
Download cryptography library and build for wasm Download cryptography source code at GitHub, cryptopp. Go to cryptopp folder which contains GNUmakefile. Build it to generate C++ library and execute file. make static dynamic cryptest.exe Create a new folder build and move all generated files into it. mv *.o *.so *.a Read more…
std::thread #include <iostream> #include <thread> #include <chrono> void f1(int n) { for (int i = 0; i < 5; ++i) { std::cout << “function f1 executing\n”; ++n; std::this_thread::sleep_for(std::chrono::milliseconds(10)); } } void f2(int& n) { for (int i = 0; i < 5; ++i) { std::cout << “function f2 executing\n”; ++n; Read more…
Constexpr : Know Value At Compile Time int main(int argc, char** argv ) { int size0; constexpr auto size1 = 10; //constexpr auto size2 = size0; //error: constexpr variable ‘size2’ must be initialized by a constant expression return 0; } Mark Function Delete To Avoid Data Type Conversion void ShowValue(double Read more…
Get field value by std::get from container We can use std::get to fetch field value from container object. It can help us to avoid use iteractor to access first or second element. #include <iostream> #include <tuple> #include <string> #include <map> #include <vector> using namespace std; using Info = std::tuple<std::string, int, Read more…
The article show demoes about use ifstream to read file written by qfile and use qfile to read file written by ofstream. Use ifstream to read file written by QFile #include <QCoreApplication> #include <QString> #include <QFile> #include <iostream> #include <fstream> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QString Read more…
If two numbers are equal and the relative positions are not changed after sorting, we think the sorting algorithm is stable. Stable sort algorithm: bubble sort, insert sort and merge sort. Unstable sort algorithm: quick sort, heap sort. Introduce an unstable sort algorithm quick sort. Its core thought is divide Read more…
The article is similar to my old post C++: Save Data To A Local File That Humans Can Read. I want to save a little data into a local file that human can’t read it. It is best done conveniently through C Plus Plus.The following example shows the entire logic. Read more…