Slicing engine for 3D printing technology (4)

Source: Internet
Author: User

"This series of articles is based on the melting deposition (fused depostion modeling, FDM) forming process"
This article I talk about the issue of multilateral printing, multilateral printing is a key technology of the slicing engine, first of all, it can ensure that the printing solid surface from the internal filling of the impact, to ensure the authenticity of the appearance, and secondly, in the upper layer in contrast to the lower tilt, the multilateral printing can be very good support to avoid upper collapse.
However, at present, my multilateral printing is not universal enough, for some nonstandard models, and the model is very sharp characteristics of the effect is not good, for most of the more smooth model is completely no problem.
Here's how it works: assuming any neighboring vector AB and BC in the boundary, here is the point D (a point on the center line of the angle ABC), see:

To find out the D point of each adjacent vector in the bounding ring, the work is basically completed. So the principle is very simple, but is a lot of trivial details to deal with, such as the direction of the vector BD, B-point and D-point Euclidean distance, and so on, do not repeat, the following presented code.

voidGetangularbisector (float3 &bisector,float3 point,float3 leftpoint,float3 rightpoint) {FLOAT3 v1,v2;floatNorm1,norm2,angle;    Get_vector_diff (V1,leftpoint,point); Get_vector_diff (V2,rightpoint,point);if(v1[0]*v2[1]==v1[1]*v2[0])    {if(v1[1]==v2[1]) {bisector[0]=0; bisector[1]=1; bisector[2]=0; }Else if(v1[0]==v2[0]) {bisector[0]=1; bisector[1]=0; bisector[2]=0; }Else{bisector[0]=point[0]-1; bisector[1]= ((v1[0]-v2[0]) + (v1[1]-v2[1]) *point[1])/(v1[1]-v2[1]); bisector[2]=0; }    }Else{getnormalizevector (v1); Getnormalizevector (v2);if(v1[0]*v2[1]==v1[1]*v2[0])        {if(v1[1]==v2[1]) {bisector[0]=0; bisector[1]=1; bisector[2]=0; }Else if(v1[0]==v2[0]) {bisector[0]=1; bisector[1]=0; bisector[2]=0; }Else{bisector[0]=point[0]-1; bisector[1]= ((v1[0]-v2[0]) + (v1[1]-v2[1]) *point[1])/(v1[1]-v2[1]); bisector[2]=0; }        }Else{get_vector_sum (BISECTOR,V1,V2); }    }}voidGetinnerpoint (float3 &innerpoint,float3 point,float3 leftpoint,float3 rightpoint,floatmargin) {FLOAT3 bisector;floatDistance,rate;    Distance=margin;    Getangularbisector (Bisector,point,leftpoint,rightpoint); rate=distance/sqrt(POW(bisector[0],2)+POW(bisector[1],2)+POW(bisector[2],2)); innerpoint[0]=point[0]+bisector[0]*rate; innerpoint[1]=point[1]+bisector[1]*rate; innerpoint[2]=point[2]+bisector[2]*rate;if(Get_vector3_det (Point,rightpoint,innerpoint) <0) {innerpoint[0]=point[0]-bisector[0]*rate; innerpoint[1]=point[1]-bisector[1]*rate; innerpoint[2]=point[2]-bisector[2]*rate; }}voidGetinnerpoint (Phasor *innerphasor,phasor *phasor,phasor*leftphasor,phasor *rightphasor,floatMarginintfillmaterial) {Getinnerpoint (innerphasor->beginpoint,phasor->beginpoint,leftphasor->beginpoint,phasor-    >endpoint,margin); Getinnerpoint (Innerphasor->endpoint,phasor->endpoint,phasor->beginpoint,rightphasor->endpoint,    margin); Innerphasor->material=fillmaterial;}voidGetinnerboundary (Phasor *&innerphasors,phasor *phasors,intPhasor_num, vector<vector<int> >&closedset,floatLineheight,intFillmaterial,BOOL*innerboundarystatus) {innerphasors=NewPhasor[phasor_num];intIndex,indexmain,phasorindex,phasorindexleft,phasorindexright;floatMargin=lineheight;againscan:if(margin<0.1) {*innerboundarystatus=false; Innerphasors=null;return; } for(indexmain=0; Indexmain!=closedset.size (); ++indexmain) {intCount=0; for(index=0; Index!=closedset[indexmain].size (); ++index) {Phasorindex=closedset[indexmain][index];if(index>0) {phasorindexleft=closedset[indexmain][index-1]; }Else{phasorindexleft=closedset[indexmain][closedset[indexmain].size ()-1]; } phasorindexright=closedset[indexmain][(index+1)%closedset[indexmain].size ()];                Getinnerpoint (Innerphasors+phasorindex, Phasors+phasorindex, Phasors+phasorindexleft , Phasors+phasorindexright, margin,fillmaterial); for(intI=0; i!=phasor_num;++i) {if(I==phasorindex) {Continue; }if(Get_vector_distance2 (innerphasors[phasorindex].beginpoint,phasors[phasorindex].beginpoint) > Get_vec Tor_distance2 (Innerphasors[phasorindex].beginpoint,phasors[i].beginpoint)) {count++; Break; }            }if(Count>closedset[indexmain].size ()/5+1) {margin-=0.05;GotoAgainscan; }        }    }}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Slicing engine for 3D printing technology (4)

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.