File IO Between QFile And std fstream

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…

Open File By Browser & Set Mouse Position By VTK

Open File By Browser The FileReader object lets web applications asynchronously read the contents of file. You can feel the effect at: https://www.weiy.city/web-test/open-file/ <!doctype html> <html lang=”en”> <head> <title>Test</title> </head> <body> <input type=”file” id=”file-input” /> <h3>Contents of the file:</h3> <pre id=”file-content”></pre> <script> function displayContents(contents) { var element = document.getElementById(‘file-content’); element.textContent Read more…

VTK – Calculate Distance Between Two 3D Models

The post shows a way to calculate unsigned distance Between Two 3D Models. The models can’t have too low resolution because the result that vtkDistancePolyDataFilter computes will not be accurate. #include <vtkActor.h> #include <vtkCleanPolyData.h> #include <vtkDistancePolyDataFilter.h> #include <vtkNamedColors.h> #include <vtkNew.h> #include <vtkPointData.h> #include <vtkPolyDataMapper.h> #include <vtkPolyDataReader.h> #include <vtkProperty.h> #include <vtkRenderWindow.h> Read more…

Export CPlusPlus Algorithm To Javascript Code

I will show a way to export CPlusPlus algorithm to javascript code. Write Pollard’s rho algorithm in class Resolver for integer factorization. resolver.h #include <string> typedef long long LL; class Resolver { public: Resolver(); ~Resolver(); std::string GetResolvedResult(int x); protected: void find(LL n,LL c); bool Miller_rabin(LL p); LL Pollard_rho(LL n,LL c); Read more…

HTML: Render Math Formula By MathJax

We will render math Formula in browser by Js engine MathJax. Download the mathjax package to host it from our own server. git clone https://github.com/mathjax/MathJax.git mj-tmp mv mj-tmp/es5 <path-to-server-location>/mathjax rm -rf mj-tmp Write a JS file which import mathjax to analyze string which contains latex math code. check-for-tex.js: (function () Read more…

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X