## VTK – Find Partial Region And Its Normal

Find a local partial region on the surface of the sphere, mark it by red color. Finally, we will compute the normal of the partial region and show it by a green line. The whole scene is just like the following image. Here are a few steps about the process. Read more…

## VTK – Expand Sample Area From A Cell

The article introduces how to expand the sampling area from a cell. I marked the area red color, the center point is computed as the mass center of the original cell. Step 1, find all cells which are near to the center point within a distance. We can use the Read more…

## Find The Biggest Plane On The Surface Of 3D Model

This post introduces a way to find the biggest plane on the 3D model. We expand the initial cell by comparing its normal with neighbor’s normal. It indicates they are on a plane if the two normals of cells are approximately equal. I use vtkOBBTree to find the min axes Read more…

## Three Basic Activation Functions For Neural Network Algorithm

Step function The step function is simple, it gets only two values zero or one no matter what the input value is. #!/usr/bin/env python import numpy as np import matplotlib.pylab as plt def step_function(x): return np.array(x>0, dtype=np.int) if __name__ == ‘__main__’: x = np.arange( -5, 5, 0.1 ) y = Read more…

## Find 3D Model’s Boundary In VTK

We define all edges in the boundary have no neighbor cells. It indicates that there is no boundary on the closed surface. In the following example, I read an STL file and get an arch. Step 1, clip the original arch with a plane that has normal (0, 1, 0) Read more…

## Improved Bubble Sort

Almost every developer know how to implement the bubble sort for a simple array. We just need to travel over the array in two levels and swap the adjacent elements in the second level if their values’ order is not correct. The algorithm implement with Python is in the following Read more…

## CPP – Delete Special Elements In Vector

We often need to delete some elements in an STL set. But it causes a strange bug if we are careless sometimes. One newbie in C Plus Plus program language may write the following code to delete all odd numbers in a set. int main() { vector<int> vec{ 1, 3, Read more…

## Python & Algorithm – Equation Solving

I want to get the solution of the equation Bisection Method The first algorithm for the problem is bisection method. The algorithm bisection method doesn’t require derivation for the equation. It just needs a possible solution range [l, r], then calculates the variable mid as , compares the result of Read more…

A prohibited operation