"This series of articles is based on melt deposition (fused depostion modeling, FDM) forming process "
Starting with this article, I'll talk about some techniques for solid slicing.
Slicing engine, the entity section roughly includes:
extract boundary Vector --add vector The collection.
generate fill vector Collection, It is also the core of the entire slicing engine technology, as the four core elements that weigh the good or bad of an engine are-- solidity, similarity to the original model, how much material is used, and how fast or fast is mostly determined by the padding vector generation technology. Currently build fill vector algorithm also there are a lot of unknown problems to be overcome, for this piece of technology I will discuss with you at the end, in this article, I mainly say the extraction boundary vector technology.
Extracting boundary vectors is a vector set that intersects the model with a layer (Z-plane) when the model is layered, and the end-to-end phase in a particular order (generally defined as a positive direction along the negative Z axis).
The main difficulty is to all the layers in a specific order of the end-to-end, see:
This is a vector collection of a layer generated by a model under Skeinforge. Look at its boundary vectors , as described above, in a particular order, the end-to-end phase.
Here for triangular patches and Z-plane intersection This is a high school analytic geometry, and the end -to-end only need to understand the data structure is very easy to do. I will not dwell on it here.
I'll just say how to get all the intersection lines to generate boundary vectors in a particular direction.
The algorithm steps are as follows:
The first step is to find the triangular patch and the two endpoints of the Z-plane intersection line: Beginpoint and endpoint, assuming that it is the vector that we want to match a particular order: Phasor. Start node: Beginpoint, End node: EndPoint.
The second step is to determine whether the vector conforms to our requirements, and if it does not conform, reverse it.
The steps are as follows:
1, do beginpoint and Span style= "font-family:fangsong_gb2312; font-size:18px; Line-height:26px ">endpoint of the poor Vectordiff.
2, the normal vector of vectordiff and the triangular patch cross.
3, Beginpoint and cross are added to get vectoradd.
4, do three vectors (1,1,z), ( 1,0,z), (0,1,z). The third element of these three vectors is Z, to ensure that the linear independent (three linearly independent vectors determine a plane).
5, for these three vectors and vectoradd do four-point determinant, if the value of the determinant is less than 0, reversed, otherwise not reversed.
Perhaps for beginners, the four-point determinant is somewhat difficult to understand, so see my other blog post: Devillers & Guigue algorithm.
Why do this, there is a little bit of algorithmic knowledge of the students easy to understand, the purpose of this is to make full use of the normal vector to judge the reasonable direction of the two-dimensional vector, because the traditional polygonal surface of the 3D model of discretization, the normal vector uniquely identifies the 3D model face direction, To make the boundary vector direction specification extracted, we must make full use of the normal vector information.
As for the three vectors I have made, it is to calibrate the z plane, just find three unrelated vectors on this plane.
Speaking so much, the above algorithm should not be difficult to understand.
The code for the algorithm is presented below.
Vector struct PHASOR{FLOAT3 beginpoint,endpoint;int status;int material;int tri_index;void reversal () {FLOAT3 temp;memcpy (Temp,beginpoint,sizeof (float)); memcpy (beginpoint,endpoint,sizeof (float)); memcpy (Endpoint,temp,sizeof ( float);} void copy (Phasor *p) {memcpy (beginpoint,p->beginpoint,sizeof (float)); memcpy (Endpoint,p->endpoint,sizeof ( float);status=p->status;material=p->material;tri_index=p->tri_index;}}; void Get_vector_diff (float3& aimv, const FLOAT3 A, const FLOAT3 b) {aimv[0] = b[0]-a[0]; AIMV[1] = b[1]-a[1]; AIMV[2] = b[2]-a[2];} void Cross_product (Float3 &result,float3 A, float3 b) {result[0] = a[1]*b[2]-a[2]*b[1];result[1] = a[2]*b[0]-a[0]*b [2];result[2] = a[0]*b[1]-a[1]*b[0];} void Get_vector_sum (float3& aimv, const FLOAT3 A, const FLOAT3 b) {aimv[0] = A[0] + b[0]; AIMV[1] = a[1] + b[1]; AIMV[2] = a[2] + b[2];} Get the four-point determinant float Get_vector4_det (FLOAT3 v1, FLOAT3 v2, FLOAT3 v3, FLOAT3 v4) {float a[3][3]; For (int i = 0; I! = 3; ++i) {A[0][i] = V1[i]-v4[i]; A[1][i] = V2[i]-v4[i]; A[2][i] = V3[i]-v4[i]; } return a[0][0] * a[1][1] * a[2][2] + a[0][1] * a[1][2] * a[2][0] + a[0][2] * a[1][0] * a[2][1]-a[0][2] * a[1][1] * A[2][0]-a[0][1] * a[1][0] * a[2][2]-a[0][0] * a[1][2] * a[2][1];} <summary>///If the boundary vector does not meet the requirements, change the vector direction///</summary>//<param name= "phasor" > Vector </param>/// Lt;param name= "normal" > Normal </param>///<param name= "z" >z coordinates </param>void stldelamination:: Rectifydirection (Phasor *phasor,float3 normal,float z) {float3 cross;float3 vectordiff;float3 vectoradd;float3 a,b,c, Temp;a[0]=1;a[1]=1;a[2]=z;b[0]=1;b[1]=0;b[2]=z;c[0]=0;c[1]=1;c[2]=z;get_vector_diff (vectorDiff,phasor-> Beginpoint,phasor->endpoint); cross_product (Cross,normal,vectordiff); Get_vector_sum (vectorAdd,phasor-> Beginpoint,cross), if (Get_vector4_det (A, B, C, Vectoradd) <0) {memcpy (temp,phasor->beginpoint,sizeof (float)) ; memcpy (phAsor->beginpoint,phasor->endpoint,sizeof (float)); memcpy (phasor->endpoint,temp,sizeof (float));}}
Slicing engine for 3D printing technology (3)