Exemplo n.º 1
0
		///<summary>If using DirectX, the vb VertexBuffer variable must be instantiated in a subsequent call to PrepareForDirectX().</summary>
		public ToothGraphic Copy() {
			ToothGraphic tg=new ToothGraphic();
			tg.toothID=this.toothID;
			tg.VertexNormals=new List<VertexNormal>();
			for(int i=0;i<this.VertexNormals.Count;i++){
				tg.VertexNormals.Add(this.VertexNormals[i].Copy());
			}
			tg.Groups=new List<ToothGroup>();
			for(int i=0;i<this.Groups.Count;i++) {
				tg.Groups.Add(this.Groups[i].Copy());
			}
			tg.visible=this.visible;
			tg.Rotate=this.Rotate;
			tg.TipB=this.TipB;
			tg.TipM=this.TipM;
			tg.ShiftM=this.ShiftM;
			tg.ShiftO=this.ShiftO;
			tg.ShiftB=this.ShiftB;
			tg.IsRCT=this.IsRCT;
			tg.hideNumber=this.hideNumber;
			tg.DrawBigX=this.DrawBigX;
			tg.colorX=this.colorX;
			tg.colorRCT=this.colorRCT;
			tg.ShowPrimaryLetter=this.ShowPrimaryLetter;
			tg.IsImplant=this.IsImplant;
			tg.colorImplant=this.colorImplant;
			tg.IsCrown=this.IsCrown;
			tg.IsPontic=this.IsPontic;
			tg.IsSealant=this.IsSealant;
			tg.colorSealant=this.colorSealant;
			return tg;
		}
Exemplo n.º 2
0
		///<summary></summary>
		private void DrawFacialView(ToothGraphic toothGraphic,Graphics g) {
			/*
			if(toothGraphic.Visible
				|| (toothGraphic.IsCrown && toothGraphic.IsImplant)
				|| toothGraphic.IsPontic) {
				//DrawTooth(toothGraphic,g);
			}
			float w=0;
			if(!Tooth.IsPrimary(toothGraphic.ToothID)) {
				w=ToothGraphic.GetWidth(toothGraphic.ToothID)/TcData.ScaleMmToPix;
					// /TcData.WidthProjection*(float)Width;
			}
			if(!Tooth.IsPrimary(toothGraphic.ToothID) && (!toothGraphic.Visible || toothGraphic.IsPontic)) {
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
					//g.FillRectangle(new SolidBrush(colorBackSimple),x-w/2f,0,w,Height/2f-20);
				}
				else {
					//g.FillRectangle(new SolidBrush(colorBackSimple),x-w/2f,Height/2f+20,w,Height/2f-20);
				}
			}*/
			if(toothGraphic.DrawBigX) {
				float x=TcData.GetTransXpix(toothGraphic.ToothID);
				float y=TcData.GetTransYfacialPix(toothGraphic.ToothID);
				float halfw=6f*TcData.PixelScaleRatio;
				float halfh=29f*TcData.PixelScaleRatio;//58;
				//float offsety=73;
				//toothGraphic.colorX
				//if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
					//g.DrawLine(new Pen(toothGraphic.colorX),x-halfxwidth,Height/2f-offsetofx-xheight,x+halfxwidth,Height/2f-offsetofx);
					//g.DrawLine(new Pen(toothGraphic.colorX),x+halfxwidth,Height/2f-offsetofx-xheight,x-halfxwidth,Height/2f-offsetofx);
					g.DrawLine(new Pen(toothGraphic.colorX,2f*TcData.PixelScaleRatio),x-halfw,y-halfh,x+halfw,y+halfh);
					g.DrawLine(new Pen(toothGraphic.colorX,2f*TcData.PixelScaleRatio),x+halfw,y-halfh,x-halfw,y+halfh);
				//}
				//else {//Mandible
					//g.DrawLine(new Pen(toothGraphic.colorX),x-halfxwidth,Height/2f+offsetofx+xheight,x+halfxwidth,Height/2f+offsetofx);
					//g.DrawLine(new Pen(toothGraphic.colorX),x+halfxwidth,Height/2f+offsetofx+xheight,x-halfxwidth,Height/2f+offsetofx);
				//	g.DrawLine(new Pen(toothGraphic.colorX),x-halfw,y+halfh,x+halfw,y);
				//	g.DrawLine(new Pen(toothGraphic.colorX),x+halfw,y+halfh,x-halfw,y);
				//}
			}
			//if(toothGraphic.Visible && toothGraphic.IsRCT) {//draw RCT
				//x=,y= etc
				//toothGraphic.colorRCT
				//?
			//}
			//if(toothGraphic.Visible && toothGraphic.IsBU) {//BU or Post
				//?
			//}
			//if(toothGraphic.IsImplant) {
				//?
			//}
		}
Exemplo n.º 3
0
		private Matrix ToothRotationMatrix(ToothGraphic toothGraphic){
			//1: tipM last
			//2: tipB second
			//3: rotate first
			Matrix rotM=Matrix.Identity;
			Matrix rotB=Matrix.Identity;
			Matrix rot=Matrix.Identity;
			if(ToothGraphic.IsRight(toothGraphic.ToothID)) {
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {//UR
					rotM.RotateZ(((float)(toothGraphic.TipM*Math.PI)/180));//Converts angle to radians as required.
					rotB.RotateX(((float)(-toothGraphic.TipB*Math.PI)/180));//Converts angle to radians as required.
					rot.RotateY(((float)(toothGraphic.Rotate*Math.PI)/180));//Converts angle to radians as required.
				} else {//LR
					rotM.RotateZ(((float)(-toothGraphic.TipM*Math.PI)/180));//Converts angle to radians as required.
					rotB.RotateX(((float)(toothGraphic.TipB*Math.PI)/180));//Converts angle to radians as required.
					rot.RotateY(((float)(-toothGraphic.Rotate*Math.PI)/180));//Converts angle to radians as required.
				}
			} else {
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {//UL
					rotM.RotateZ(((float)(-toothGraphic.TipM*Math.PI)/180));//Converts angle to radians as required.
					rotB.RotateX(((float)(-toothGraphic.TipB*Math.PI)/180));//Converts angle to radians as required.
					rot.RotateY(((float)(toothGraphic.Rotate*Math.PI)/180));//Converts angle to radians as required.
				} else {//LL
					rotM.RotateZ(((float)(toothGraphic.TipM*Math.PI)/180));//Converts angle to radians as required.
					rotB.RotateX(((float)(toothGraphic.TipB*Math.PI)/180));//Converts angle to radians as required.
					rot.RotateY(((float)(-toothGraphic.Rotate*Math.PI)/180));//Converts angle to radians as required.
				}
			}
			return rot*rotB*rotM;
		}
Exemplo n.º 4
0
		private Matrix ToothTranslationMatrix(ToothGraphic toothGraphic){
			Matrix tran=Matrix.Identity;
			if(ToothGraphic.IsRight(toothGraphic.ToothID)) {
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {//UR
					tran.Translate(toothGraphic.ShiftM,-toothGraphic.ShiftO,toothGraphic.ShiftB);
				} else {//LR
					tran.Translate(toothGraphic.ShiftM,toothGraphic.ShiftO,toothGraphic.ShiftB);
				}
			} else {
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {//UL
					tran.Translate(-toothGraphic.ShiftM,-toothGraphic.ShiftO,toothGraphic.ShiftB);
				} else {//LL
					tran.Translate(-toothGraphic.ShiftM,toothGraphic.ShiftO,toothGraphic.ShiftB);
				}
			}
			return tran;
		}
Exemplo n.º 5
0
		///<summary></summary>
		private void DrawToothOcclusal(ToothGraphic toothGraphic,Graphics g) {
			ToothGroup group;
			float x,y;
			Pen outline=new Pen(Color.Gray);
			for(int i=0;i<toothGraphic.Groups.Count;i++) {
				group=(ToothGroup)toothGraphic.Groups[i];
				if(!group.Visible) {
					continue;
				}
				x=TcData.GetTransXpix(toothGraphic.ToothID);
				y=TcData.GetTransYocclusalPix(toothGraphic.ToothID);
				float sqB=4;//half the size of the central square. B for Big.
				float cirB=9.5f;//radius of outer circle
				float sqS=3;//S for small
				float cirS=8f;
				GraphicsPath path;
				SolidBrush brush=new SolidBrush(group.PaintColor);
				string dir;
				switch(group.GroupType) {
					case ToothGroupType.O:
						g.FillRectangle(brush,x-sqB,y-sqB,2f*sqB,2f*sqB);
						g.DrawRectangle(outline,x-sqB,y-sqB,2f*sqB,2f*sqB);
						break;
					case ToothGroupType.I:
						g.FillRectangle(brush,x-sqS,y-sqS,2f*sqS,2f*sqS);
						g.DrawRectangle(outline,x-sqS,y-sqS,2f*sqS,2f*sqS);
						break;
					case ToothGroupType.B:
						if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
							path=GetPath("U",x,y,sqB,cirB);
						}
						else {
							path=GetPath("D",x,y,sqB,cirB);
						}
						g.FillPath(brush,path);
						g.DrawPath(outline,path);
						break;
					case ToothGroupType.F:
						if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
							path=GetPath("U",x,y,sqS,cirS);
						}
						else {
							path=GetPath("D",x,y,sqS,cirS);
						}
						g.FillPath(brush,path);
						g.DrawPath(outline,path);
						break;
					case ToothGroupType.L:
						if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
							dir="D";
						}
						else {
							dir="U";
						}
						if(ToothGraphic.IsAnterior(toothGraphic.ToothID)) {
							path=GetPath(dir,x,y,sqS,cirS);
						}
						else {
							path=GetPath(dir,x,y,sqB,cirB);
						}
						g.FillPath(brush,path);
						g.DrawPath(outline,path);
						break;
					case ToothGroupType.M:
						if(ToothGraphic.IsRight(toothGraphic.ToothID)) {
							dir="R";
						}
						else {
							dir="L";
						}
						if(ToothGraphic.IsAnterior(toothGraphic.ToothID)) {
							path=GetPath(dir,x,y,sqS,cirS);
						}
						else {
							path=GetPath(dir,x,y,sqB,cirB);
						}
						g.FillPath(brush,path);
						g.DrawPath(outline,path);
						break;
					case ToothGroupType.D:
						if(ToothGraphic.IsRight(toothGraphic.ToothID)) {
							dir="L";
						}
						else {
							dir="R";
						}
						if(ToothGraphic.IsAnterior(toothGraphic.ToothID)) {
							path=GetPath(dir,x,y,sqS,cirS);
						}
						else {
							path=GetPath(dir,x,y,sqB,cirB);
						}
						g.FillPath(brush,path);
						g.DrawPath(outline,path);
						break;
				}
				//group.PaintColor
				//Gl.glCallList(displayListOffset+toothGraphic.GetIndexForDisplayList(group));
			}
		}
Exemplo n.º 6
0
		///<summary>Performs the rotations and translations entered by user for this tooth.  Usually, all numbers are just 0, resulting in no movement here.</summary>
		private void RotateAndTranslateUser(ToothGraphic toothGraphic) {
			//remembering that they actually show in the opposite order, so:
			//1: translate
			//2: tipM last
			//3: tipB second
			//4: rotate first
			if(ToothGraphic.IsRight(toothGraphic.ToothID)) {
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {//UR
					Gl.glTranslatef(toothGraphic.ShiftM,-toothGraphic.ShiftO,toothGraphic.ShiftB);
					Gl.glRotatef(toothGraphic.TipM,0,0,1f);
					Gl.glRotatef(-toothGraphic.TipB,1f,0,0);
					Gl.glRotatef(toothGraphic.Rotate,0,1f,0);
				}
				else {//LR
					Gl.glTranslatef(toothGraphic.ShiftM,toothGraphic.ShiftO,toothGraphic.ShiftB);
					Gl.glRotatef(-toothGraphic.TipM,0,0,1f);
					Gl.glRotatef(toothGraphic.TipB,1f,0,0);
					Gl.glRotatef(-toothGraphic.Rotate,0,1f,0);
				}
			}
			else {
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {//UL
					Gl.glTranslatef(-toothGraphic.ShiftM,-toothGraphic.ShiftO,toothGraphic.ShiftB);
					Gl.glRotatef(-toothGraphic.TipM,0,0,1f);
					Gl.glRotatef(-toothGraphic.TipB,1f,0,0);
					Gl.glRotatef(toothGraphic.Rotate,0,1f,0);
				}
				else {//LL
					Gl.glTranslatef(-toothGraphic.ShiftM,toothGraphic.ShiftO,toothGraphic.ShiftB);
					Gl.glRotatef(toothGraphic.TipM,0,0,1f);
					Gl.glRotatef(toothGraphic.TipB,1f,0,0);
					Gl.glRotatef(-toothGraphic.Rotate,0,1f,0);
				}
			}
		}
Exemplo n.º 7
0
		private void DrawOcclusalView(ToothGraphic toothGraphic) {
			//now the occlusal surface. Notice that it's relative to origin again
			Gl.glPushMatrix();//remember position of origin
			Gl.glTranslatef(TcData.GetTransX(toothGraphic.ToothID),TcData.GetTransYocclusal(toothGraphic.ToothID),0);
			if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
				Gl.glRotatef(-110f,1f,0,0);//rotate angle about line from origin to x,y,z
			}
			else {//mandibular
				if(ToothGraphic.IsAnterior(toothGraphic.ToothID)) {
					Gl.glRotatef(110f,1f,0,0);
				}
				else {
					Gl.glRotatef(120f,1f,0,0);
				}
			}
			RotateAndTranslateUser(toothGraphic);
			if(!Tooth.IsPrimary(toothGraphic.ToothID)//if perm tooth
				&& Tooth.IsValidDB(Tooth.PermToPri(toothGraphic.ToothID))
				&& TcData.ListToothGraphics[Tooth.PermToPri(toothGraphic.ToothID)].Visible)//and the primary tooth is visible
			{
				//do not paint
			}
			else if(toothGraphic.Visible//might not be visible if an implant
				|| (toothGraphic.IsCrown && toothGraphic.IsImplant))//a crown on an implant will paint
				//pontics won't paint, because tooth is invisible
			{
				DrawTooth(toothGraphic);
			}
			Gl.glPopMatrix();//reset to origin
			if(toothGraphic.Visible && toothGraphic.IsSealant){//draw sealant
				Gl.glPushMatrix();
				Gl.glTranslatef(0,0,6f);//move forward 6mm so it will be visible.
				Gl.glTranslatef(TcData.GetTransX(toothGraphic.ToothID),TcData.GetTransYocclusal(toothGraphic.ToothID),0);
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
					Gl.glRotatef(-110f,1f,0,0);//rotate angle about line from origin to x,y,z
				}
				else {//mandibular
					if(ToothGraphic.IsAnterior(toothGraphic.ToothID)) {
						Gl.glRotatef(110f,1f,0,0);
					}
					else {
						Gl.glRotatef(120f,1f,0,0);
					}
				}
				Gl.glDisable(Gl.GL_LIGHTING);
				Gl.glEnable(Gl.GL_BLEND);
				Gl.glColor3f(
					(float)toothGraphic.colorSealant.R/255f,
					(float)toothGraphic.colorSealant.G/255f,
					(float)toothGraphic.colorSealant.B/255f);
				//.5f);//only 1/2 darkness
				Gl.glBlendFunc(Gl.GL_SRC_ALPHA,Gl.GL_ONE_MINUS_SRC_ALPHA);
				Gl.glLineWidth(2f*TcData.PixelScaleRatio);
				Gl.glPointSize(1.7f*TcData.PixelScaleRatio);//point is slightly smaller since no antialiasing
				RotateAndTranslateUser(toothGraphic);
				LineSimple line=toothGraphic.GetSealantLine();
				Gl.glBegin(Gl.GL_LINE_STRIP);
				for(int j=0;j<line.Vertices.Count;j++) {//loop through each vertex
					Gl.glVertex3f(line.Vertices[j].X,line.Vertices[j].Y,line.Vertices[j].Z);
				}
				Gl.glEnd();
				//The next 30 or so lines are all a stupid OpenGL workaround to hide the line intersections with big dots.
				Gl.glPopMatrix();
				//now, draw a point at each intersection to hide the unsightly transitions
				Gl.glPushMatrix();
				//move foward so it will cover the lines
				Gl.glTranslatef(0,0,6.5f);
				Gl.glTranslatef(TcData.GetTransX(toothGraphic.ToothID),TcData.GetTransYocclusal(toothGraphic.ToothID),0);
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
					Gl.glRotatef(-110f,1f,0,0);//rotate angle about line from origin to x,y,z
				}
				else {//mandibular
					if(ToothGraphic.IsAnterior(toothGraphic.ToothID)) {
						Gl.glRotatef(110f,1f,0,0);
					}
					else {
						Gl.glRotatef(120f,1f,0,0);
					}
				}
				RotateAndTranslateUser(toothGraphic);
				Gl.glDisable(Gl.GL_BLEND);
				Gl.glBegin(Gl.GL_POINTS);
				for(int j=0;j<line.Vertices.Count;j++) {//loop through each vertex
					//but ignore the first and last.  We are only concerned with where lines meet.
					if(j==0 || j==line.Vertices.Count-1) {
						continue;
					}
					Gl.glVertex3f(line.Vertices[j].X,line.Vertices[j].Y,line.Vertices[j].Z);
				}
				Gl.glEnd();
				Gl.glPopMatrix();
			}
		}
Exemplo n.º 8
0
		private void DrawFacialView(ToothGraphic toothGraphic,Matrix defOrient) {
			Matrix toothTrans=Matrix.Identity;
			toothTrans.Translate(GetTransX(toothGraphic.ToothID),
				GetTransYfacial(toothGraphic.ToothID),
				0);
			Matrix rotAndTranUser=ToothRotationAndTranslationMatrix(toothGraphic);
			device.Transform.World=rotAndTranUser*toothTrans*defOrient;
			if(toothGraphic.Visible
				||(toothGraphic.IsCrown && toothGraphic.IsImplant)
				||toothGraphic.IsPontic) 
			{
				DrawTooth(toothGraphic);
			}
			device.RenderState.ZBufferEnable=false;
			device.RenderState.Lighting=false;
			Matrix lineMatrix=ScreenSpaceMatrix();
			Line line=new Line(device);
			line.GlLines=true;
			if(toothGraphic.DrawBigX) {
				//Thickness of line depends on size of window.
				//The line size needs to be slightly larger than in OpenGL because
				//lines are drawn with polygons in DirectX and they are anti-aliased,
				//even when the line.Antialias flag is set.
				line.Width=2.2f*TcData.PixelScaleRatio;
				line.Begin();
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
					line.DrawTransform(new Vector3[] {
						new Vector3(-2f,12f,0f),
						new Vector3(2f,-6f,0f),},
						lineMatrix,
						toothGraphic.colorX);
					line.DrawTransform(new Vector3[] {
						new Vector3(2f,12f,0f),
						new Vector3(-2f,-6f,0f),},
						lineMatrix,
						toothGraphic.colorX);
				} 
				else {
					line.DrawTransform(new Vector3[] {
						new Vector3(-2f,6f,0f),
						new Vector3(2f,-12f,0f),},
						lineMatrix,
						toothGraphic.colorX);
					line.DrawTransform(new Vector3[] {
						new Vector3(2f,6f,0f),
						new Vector3(-2f,-12f,0f),},
						lineMatrix,
						toothGraphic.colorX);
				}
				line.End();
			}
			if(toothGraphic.Visible && toothGraphic.IsRCT) {//draw RCT
				//Thickness of lines depend on size of window.
				//The line size needs to be slightly larger than in OpenGL because
				//lines are drawn with polygons in DirectX and they are anti-aliased,
				//even when the line.Antialias flag is set.
				line.Width=2.5f*TcData.PixelScaleRatio;
				line.Begin();
				List<LineSimple> linesSimple=toothGraphic.GetRctLines();
				for(int i=0;i<linesSimple.Count;i++) {
					if(linesSimple[i].Vertices.Count<2){
						continue;//Just to avoid internal errors, even though not likely.
					}
					//Convert each line strip into very simple two point lines so that line extensions can be calculated more easily below.
					//Items in the array are tuples of (2D point,bool indicating end point).
					List <object> twoPointLines=new List<object> ();
					for(int j=0;j<linesSimple[i].Vertices.Count-1;j++){
					  twoPointLines.Add(new Vector3(
							linesSimple[i].Vertices[j  ].X,
							linesSimple[i].Vertices[j  ].Y,
							linesSimple[i].Vertices[j  ].Z));
						twoPointLines.Add(j==0);
					  twoPointLines.Add(new Vector3(
							linesSimple[i].Vertices[j+1].X,
							linesSimple[i].Vertices[j+1].Y,
							linesSimple[i].Vertices[j+1].Z));
						twoPointLines.Add(j==linesSimple[i].Vertices.Count-2);
					}
					//Draw each individual two point line. The lines must be broken down from line strips so that when individual two point
					//line locations are modified they do not affect any other two point lines within the same line strip.
					for(int j=0;j<twoPointLines.Count;j+=4){
					  Vector3 p1=(Vector3)twoPointLines[j];
						bool p1IsEndPoint=(bool)twoPointLines[j+1];
					  Vector3 p2=(Vector3)twoPointLines[j+2];
						bool p2IsEndPoint=(bool)twoPointLines[j+3];
					  Vector3 lineDir=p2-p1;
					  lineDir.Normalize();//Gives the line direction a single unit length.
					  float extSize=0.25f;//The number of units to extend each end of the two point line.
						if(!p1IsEndPoint){//Do not extend the endpoints for the ends of the line strips.
							p1=p1-extSize*lineDir;
						}
						if(!p2IsEndPoint){//Do not extend the endpoints for the ends of the line strips.
							p2=p2+extSize*lineDir;
						}
					  Vector3[] lineVerts=new Vector3[] {p1,p2};
					  line.DrawTransform(lineVerts,lineMatrix,toothGraphic.colorRCT);
					}
				}
				line.End();
			}
			ToothGroup groupBU=toothGraphic.GetGroup(ToothGroupType.Buildup);//during debugging, not all teeth have a BU group yet.
			if(toothGraphic.Visible && groupBU!=null && groupBU.Visible) {//BU or Post
				device.RenderState.ZBufferEnable=false;
				device.RenderState.Lighting=true;
				device.Lights[0].Enabled=false;//Disable the scene light.
				device.Lights[1].Ambient=Color.White;
				device.Lights[1].Enabled=true;
				Color colorBU=toothGraphic.GetGroup(ToothGroupType.Buildup).PaintColor;
				device.VertexFormat=CustomVertex.PositionNormal.Format;
				device.SetStreamSource(0,toothGraphic.vb,0);
				Material material=new Material();
				material.Ambient=colorBU;
				device.Material=material;
				device.Indices=groupBU.facesDirectX;
				device.DrawIndexedPrimitives(PrimitiveType.TriangleList,0,0,toothGraphic.VertexNormals.Count,0,groupBU.NumIndicies/3);
				device.Lights[0].Enabled=true;
				device.Lights[1].Enabled=false;
			}
			if(toothGraphic.IsImplant) {
				DrawImplant(toothGraphic);
			}
			line.Dispose();
			device.RenderState.ZBufferEnable=true;
			device.RenderState.Lighting=true;
		}
Exemplo n.º 9
0
		///<summary></summary>
		public void Remove(ToothGraphic value) {
			List.Remove(value);
		}
Exemplo n.º 10
0
		///<summary></summary>
		public void Insert(int index,ToothGraphic value) {
			List.Insert(index,value);
		}
Exemplo n.º 11
0
		///<summary></summary>
		public int IndexOf(ToothGraphic value) {
			return (List.IndexOf(value));
		}
Exemplo n.º 12
0
		///<summary></summary>
		public int Add(ToothGraphic value) {
			return (List.Add(value));
		}
Exemplo n.º 13
0
		private void RenderToothWatch(Graphics g,ToothGraphic toothGraphic){
			float toMm=1f/TcData.ScaleMmToPix;
			SolidBrush brush=new SolidBrush(toothGraphic.colorWatch);
			//Drawing a white silhouette around the colored watch W doesn't make sense here because unerupted teeth do not change color in this chart.
			if(ToothGraphic.IsRight(toothGraphic.ToothID)){
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)){
					g.DrawString("W",Font,brush,new PointF(TcData.GetTransXpix(toothGraphic.ToothID)+toothGraphic.ShiftM-6f,0));
				}
				else{
					g.DrawString("W",Font,brush,new PointF(TcData.GetTransXpix(toothGraphic.ToothID)+toothGraphic.ShiftM-7f,Height-Font.Size-8f));
				}
			}
			else{
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)){
					g.DrawString("W",Font,brush,new PointF(TcData.GetTransXpix(toothGraphic.ToothID)-toothGraphic.ShiftM-6f,0));
				}
				else{
					g.DrawString("W",Font,brush,new PointF(TcData.GetTransXpix(toothGraphic.ToothID)-toothGraphic.ShiftM-7f,Height-Font.Size-8f));
				}
			}
			brush.Dispose();
		}
Exemplo n.º 14
0
		///<summary>Performs the rotations and translations entered by user for this tooth.  Usually, all numbers are just 0, resulting in no movement here. Returns the result as a Matrix that will need to be applied to any other movement and rotation matricies being applied to the tooth.</summary>
		private Matrix ToothRotationAndTranslationMatrix(ToothGraphic toothGraphic) {
			//remembering that they actually show in the opposite order, so:
			//1: translate
			//2: tipM last
			//3: tipB second
			//4: rotate first
			return ToothRotationMatrix(toothGraphic)*ToothTranslationMatrix(toothGraphic);
		}
Exemplo n.º 15
0
		///<summary></summary>
		public bool Contains(ToothGraphic value) {
			//If value is not of type ToothGraphic, this will return false.
			return (List.Contains(value));
		}
Exemplo n.º 16
0
		private void RenderToothWatch(ToothGraphic toothGraphic,Matrix defOrient){
			Matrix toothTrans=Matrix.Identity;//Start with world transform defined by calling function.
			if(ToothGraphic.IsRight(toothGraphic.ToothID)) {
				toothTrans.Translate(GetTransX(toothGraphic.ToothID)+toothGraphic.ShiftM,0,0);
			} 
			else {
				toothTrans.Translate(GetTransX(toothGraphic.ToothID)-toothGraphic.ShiftM,0,0);
			}
			device.Transform.World=toothTrans*defOrient;
			float toMm=1f/TcData.ScaleMmToPix;			  
	    if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)){
	      PrintString("W",TcData.PixelScaleRatio*(-8f*toMm),TcData.PixelScaleRatio*(155f*toMm),-6f,Color.White,xWatchFontBig);//Just white for now.
				PrintString("W",TcData.PixelScaleRatio*(-6f*toMm),TcData.PixelScaleRatio*(153f*toMm),-6f,toothGraphic.colorWatch,xWatchFont);
	    }
			else{
	      PrintString("W",TcData.PixelScaleRatio*(-8f*toMm),TcData.PixelScaleRatio*(-136f*toMm),-6f,Color.White,xWatchFontBig);//Just white for now.
				PrintString("W",TcData.PixelScaleRatio*(-6f*toMm),TcData.PixelScaleRatio*(-138f*toMm),-6f,toothGraphic.colorWatch,xWatchFont);
	    }
		}
Exemplo n.º 17
0
		private void DrawImplant(ToothGraphic toothGraphic){
			device.RenderState.ZBufferEnable=true;
			device.RenderState.Lighting=true;
			if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
				//flip the implant upside down
				device.Transform.World=Matrix.RotationZ((float)Math.PI)*device.Transform.World;
			}
			Material material=new Material();
			material.Ambient=toothGraphic.colorImplant;
			material.Diffuse=toothGraphic.colorImplant;
			material.Specular=specular_color_normal;
			material.SpecularSharpness=specularSharpness;
			device.Material=material;
			ToothGraphic implantGraphic=TcData.ListToothGraphics["implant"];
			device.VertexFormat=CustomVertex.PositionNormal.Format;
			device.SetStreamSource(0,implantGraphic.vb,0);
			for(int g=0;g<implantGraphic.Groups.Count;g++) {
				ToothGroup group=(ToothGroup)implantGraphic.Groups[g];
				if(!group.Visible||group.GroupType==ToothGroupType.Buildup) {
					continue;
				}
				device.Indices=group.facesDirectX;
				device.DrawIndexedPrimitives(PrimitiveType.TriangleList,0,0,implantGraphic.VertexNormals.Count,0,group.NumIndicies/3);
			}
		}
Exemplo n.º 18
0
		private void DrawFacialView(ToothGraphic toothGraphic) {
			Gl.glPushMatrix();//remember position of origin
			Gl.glTranslatef(TcData.GetTransX(toothGraphic.ToothID),//Move the tooth to the correct position for facial view
				TcData.GetTransYfacial(toothGraphic.ToothID),
				0);
			RotateAndTranslateUser(toothGraphic);
			if(toothGraphic.Visible
				|| (toothGraphic.IsCrown && toothGraphic.IsImplant)
				|| toothGraphic.IsPontic)
			{
				DrawTooth(toothGraphic);
			}
			Gl.glDisable(Gl.GL_DEPTH_TEST);
			if(toothGraphic.DrawBigX) {
				Gl.glDisable(Gl.GL_LIGHTING);
				Gl.glEnable(Gl.GL_BLEND);
				//move the bigX 6mm to the Facial so it will paint in front of the tooth
				Gl.glTranslatef(0,0,6f);
				Gl.glBlendFunc(Gl.GL_SRC_ALPHA,Gl.GL_ONE_MINUS_SRC_ALPHA);
				Gl.glLineWidth(2f*TcData.PixelScaleRatio);//thickness of line depends on size of window
				Gl.glColor3f (
					(float)toothGraphic.colorX.R/255f,
					(float)toothGraphic.colorX.G/255f,
					(float)toothGraphic.colorX.B/255f);
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)){
					Gl.glBegin(Gl.GL_LINES);
					Gl.glVertex2f(-2f,12f);
					Gl.glVertex2f(2f,-6f);
					Gl.glEnd();
					Gl.glBegin(Gl.GL_LINES);
					Gl.glVertex2f(2f,12f);
					Gl.glVertex2f(-2f,-6f);
					Gl.glEnd();
				}
				else{
					Gl.glBegin(Gl.GL_LINES);
					Gl.glVertex2f(-2f,6f);
					Gl.glVertex2f(2f,-12f);
					Gl.glEnd();
					Gl.glBegin(Gl.GL_LINES);
					Gl.glVertex2f(2f,6f);
					Gl.glVertex2f(-2f,-12f);
					Gl.glEnd();
				}
			}
			Gl.glPopMatrix();//reset to origin
			if(toothGraphic.Visible && toothGraphic.IsRCT) {//draw RCT
				Gl.glPushMatrix();
				Gl.glTranslatef(0,0,10f);//move RCT forward 10mm so it will be visible.
				Gl.glTranslatef(TcData.GetTransX(toothGraphic.ToothID),TcData.GetTransYfacial(toothGraphic.ToothID),0);
				Gl.glDisable(Gl.GL_LIGHTING);
				Gl.glEnable(Gl.GL_BLEND);
				Gl.glColor3f(
					(float)toothGraphic.colorRCT.R/255f,
					(float)toothGraphic.colorRCT.G/255f,
					(float)toothGraphic.colorRCT.B/255f);
					//.5f);//only 1/2 darkness
				Gl.glBlendFunc(Gl.GL_SRC_ALPHA,Gl.GL_ONE_MINUS_SRC_ALPHA);
				Gl.glLineWidth(2.2f*TcData.PixelScaleRatio);
				Gl.glPointSize(1.8f*TcData.PixelScaleRatio);//point is slightly smaller since no antialiasing
				RotateAndTranslateUser(toothGraphic);
				List<LineSimple> lines=toothGraphic.GetRctLines();
				for(int i=0;i<lines.Count;i++){
					Gl.glBegin(Gl.GL_LINE_STRIP);
					for(int j=0;j<lines[i].Vertices.Count;j++){
						Gl.glVertex3f(lines[i].Vertices[j].X,lines[i].Vertices[j].Y,lines[i].Vertices[j].Z);
					}
					Gl.glEnd();
				}
				Gl.glPopMatrix();
				//This section is a necessary workaround for OpenGL.
				//It draws a point at each intersection to hide the unsightly transitions between line segments.
				Gl.glPushMatrix();
				Gl.glTranslatef(0,0,10.5f);//move forward 10.5mm so it will cover the lines
				Gl.glTranslatef(TcData.GetTransX(toothGraphic.ToothID),TcData.GetTransYfacial(toothGraphic.ToothID),0);
				RotateAndTranslateUser(toothGraphic);
				Gl.glDisable(Gl.GL_BLEND);
				for(int i=0;i<lines.Count;i++){
					Gl.glBegin(Gl.GL_POINTS);
					for(int j=0;j<lines[i].Vertices.Count;j++) {
						//but ignore the first and last.  We are only concerned with where lines meet.
						if(j==0 || j==lines[i].Vertices.Count-1) {
							continue;
						}
						Gl.glVertex3f(lines[i].Vertices[j].X,lines[i].Vertices[j].Y,lines[i].Vertices[j].Z);
					}
					Gl.glEnd();
				}
				Gl.glPopMatrix();
			}
			ToothGroup groupBU=toothGraphic.GetGroup(ToothGroupType.Buildup);//during debugging, not all teeth have a BU group yet.
			if(toothGraphic.Visible && groupBU!=null && groupBU.Visible) {//BU or Post
				Gl.glPushMatrix();
				Gl.glTranslatef(0,0,13f);//move BU forward 13mm so it will be visible.
				Gl.glTranslatef(TcData.GetTransX(toothGraphic.ToothID),TcData.GetTransYfacial(toothGraphic.ToothID),0);
				Gl.glDisable(Gl.GL_LIGHTING);
				Gl.glDisable(Gl.GL_BLEND);
				Color colorBU=toothGraphic.GetGroup(ToothGroupType.Buildup).PaintColor;
				Gl.glColor3f(
					(float)colorBU.R/255f,
					(float)colorBU.G/255f,
					(float)colorBU.B/255f);
				RotateAndTranslateUser(toothGraphic);
				Gl.glCallList(displayListOffset+toothGraphic.GetIndexForDisplayList(toothGraphic.GetGroup(ToothGroupType.Buildup)));
				//Triangle poly=toothGraphic.GetBUpoly();
				//Gl.glBegin(Gl.GL_POLYGON);
				//for(int i=0;i<poly.Vertices.Count;i++) {
				//	Gl.glVertex3f(poly.Vertices[i].X,poly.Vertices[i].Y,poly.Vertices[i].Z);
				//}
				//Gl.glEnd();
				Gl.glPopMatrix();
			}
			if(toothGraphic.IsImplant){
				Gl.glPushMatrix();
				Gl.glTranslatef(TcData.GetTransX(toothGraphic.ToothID),//Move the tooth to the correct position for facial view
					TcData.GetTransYfacial(toothGraphic.ToothID),
					0);
				RotateAndTranslateUser(toothGraphic);
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
					//flip the implant upside down
					Gl.glRotatef(180f,0,0,1f);
				}
				Gl.glEnable(Gl.GL_LIGHTING);
				Gl.glEnable(Gl.GL_BLEND);
				Gl.glEnable(Gl.GL_DEPTH_TEST);
				ToothGroup group=(ToothGroup)TcData.ListToothGraphics["implant"].Groups[0];
				float[] material_color=new float[] {
					(float)toothGraphic.colorImplant.R/255f,
					(float)toothGraphic.colorImplant.G/255f,
					(float)toothGraphic.colorImplant.B/255f,
					(float)toothGraphic.colorImplant.A/255f
				};//RGBA
				Gl.glMaterialfv(Gl.GL_FRONT,Gl.GL_SPECULAR,specular_color_normal);
				Gl.glMaterialfv(Gl.GL_FRONT,Gl.GL_SHININESS,shininess);
				Gl.glMaterialfv(Gl.GL_FRONT,Gl.GL_AMBIENT_AND_DIFFUSE,material_color);
				Gl.glBlendFunc(Gl.GL_ONE,Gl.GL_ZERO);
				Gl.glHint(Gl.GL_POLYGON_SMOOTH_HINT,Gl.GL_NICEST);
				for(int i=0;i<group.Faces.Count;i++){//  .GetLength(0);i++) {//loop through each face
					Gl.glBegin(Gl.GL_POLYGON);
					for(int j=0;j<group.Faces[i].IndexList.Count;j++){//.Length;j++) {//loop through each vertex
						//The index for both will always be the same because we enforce a 1:1 relationship.
						//We show grabbing a float[3], but we could just as easily use the index itself.
						Gl.glVertex3fv(TcData.ListToothGraphics["implant"].VertexNormals[group.Faces[i].IndexList[j]].Vertex.GetFloatArray());//Vertices[group.Faces[i][j][0]]);
						Gl.glNormal3fv(TcData.ListToothGraphics["implant"].VertexNormals[group.Faces[i].IndexList[j]].Normal.GetFloatArray()); //.Normals[group.Faces[i][j][1]]);
					}
					Gl.glEnd();
				}
				Gl.glPopMatrix();
			}
		}
Exemplo n.º 19
0
		private void DrawOcclusalView(ToothGraphic toothGraphic,Matrix defOrient) {
			//now the occlusal surface. Notice that it's relative to origin again
			Matrix toothTrans=Matrix.Identity;//Start with world transform defined by calling function.
			toothTrans.Translate(GetTransX(toothGraphic.ToothID),
				GetTransYocclusal(toothGraphic.ToothID),
				0);
			Matrix toothRot=Matrix.Identity;
			if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)) {
				toothRot.RotateX((float)((-110f*Math.PI)/180f));//rotate angle about line from origin to x,y,z
			} else {//mandibular
				if(ToothGraphic.IsAnterior(toothGraphic.ToothID)) {
					toothRot.RotateX((float)((110f*Math.PI)/180f));
				} else {
					toothRot.RotateX((float)((120f*Math.PI)/180f));
				}
			}
			Matrix rotAndTranUser=ToothRotationAndTranslationMatrix(toothGraphic);
			device.Transform.World=rotAndTranUser*toothRot*toothTrans*defOrient;
			if(!Tooth.IsPrimary(toothGraphic.ToothID)//if perm tooth
				&&Tooth.IsValidDB(Tooth.PermToPri(toothGraphic.ToothID))
				&&TcData.ListToothGraphics[Tooth.PermToPri(toothGraphic.ToothID)].Visible)//and the primary tooth is visible
			{
				//do not paint
			} else if(toothGraphic.Visible//might not be visible if an implant
				||(toothGraphic.IsCrown&&toothGraphic.IsImplant))//a crown on an implant will paint
			//pontics won't paint, because tooth is invisible
			{
				DrawTooth(toothGraphic);
			}
			device.RenderState.ZBufferEnable=false;
			device.RenderState.Lighting=false;
			float toMm=1f/TcData.ScaleMmToPix;
			if(toothGraphic.Visible && toothGraphic.IsSealant) {//draw sealant
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)){
					PrintString("S",TcData.PixelScaleRatio*(-6f*toMm),TcData.PixelScaleRatio*(-100f*toMm),-6f,toothGraphic.colorSealant,xSealantFont);
				}else{
					PrintString("S",TcData.PixelScaleRatio*(-6f*toMm),TcData.PixelScaleRatio*(22f*toMm),-6f,toothGraphic.colorSealant,xSealantFont);
				}
			}
			device.RenderState.ZBufferEnable=true;
			device.RenderState.Lighting=true;
		}
Exemplo n.º 20
0
		private void RenderToothWatch(ToothGraphic toothGraphic){
			Gl.glPushMatrix();
			if(ToothGraphic.IsRight(toothGraphic.ToothID)) {
				Gl.glTranslatef(TcData.GetTransX(toothGraphic.ToothID)+toothGraphic.ShiftM,0,0);
			} 
			else {
				Gl.glTranslatef(TcData.GetTransX(toothGraphic.ToothID)-toothGraphic.ShiftM,0,0);
			}
			float toMm=1f/TcData.ScaleMmToPix;
			LineSimple line=toothGraphic.GetWatchLine();
			Gl.glLineWidth(3f*TcData.PixelScaleRatio);
			Gl.glColor3f(1.0f,1.0f,1.0f);//White
			Gl.glBegin(Gl.GL_LINE_STRIP);
			for(int j=0;j<line.Vertices.Count;j++) {//loop through each vertex and render the white W lines.
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)){
					Gl.glVertex3f(line.Vertices[j].X+TcData.PixelScaleRatio*(-6f*toMm),line.Vertices[j].Y+TcData.PixelScaleRatio*(150f*toMm),line.Vertices[j].Z-7f);
				}
				else{
					Gl.glVertex3f(line.Vertices[j].X+TcData.PixelScaleRatio*(-6f*toMm),line.Vertices[j].Y+TcData.PixelScaleRatio*(-140f*toMm),line.Vertices[j].Z-7f);
				}
			}
			Gl.glEnd();
			Gl.glLineWidth(0.6f*TcData.PixelScaleRatio);
			Gl.glColor3f(
				(float)toothGraphic.colorWatch.R/255f,
				(float)toothGraphic.colorWatch.G/255f,
				(float)toothGraphic.colorWatch.B/255f);
			Gl.glBegin(Gl.GL_LINE_STRIP);
			for(int j=0;j<line.Vertices.Count;j++) {//loop through each vertex and render the colored W lines.
				if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)){
					Gl.glVertex3f(line.Vertices[j].X+TcData.PixelScaleRatio*(-6f*toMm),line.Vertices[j].Y+TcData.PixelScaleRatio*(150f*toMm),line.Vertices[j].Z-6f);
				}
				else{
					Gl.glVertex3f(line.Vertices[j].X+TcData.PixelScaleRatio*(-6f*toMm),line.Vertices[j].Y+TcData.PixelScaleRatio*(-140f*toMm),line.Vertices[j].Z-6f);
				}
			}
			Gl.glEnd();
			Gl.glDisable(Gl.GL_BLEND);
			Gl.glPointSize(2f*TcData.PixelScaleRatio);
			Gl.glColor3f(1.0f,1.0f,1.0f);//White
			Gl.glBegin(Gl.GL_POINTS);
			for(int j=0;j<line.Vertices.Count;j++) {//loop through each vertex and render the colored W points.
			  if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)){
			    Gl.glVertex3f(line.Vertices[j].X+TcData.PixelScaleRatio*(-6f*toMm),line.Vertices[j].Y+TcData.PixelScaleRatio*(150f*toMm),line.Vertices[j].Z+7f);
			  }
			  else{
			    Gl.glVertex3f(line.Vertices[j].X+TcData.PixelScaleRatio*(-6f*toMm),line.Vertices[j].Y+TcData.PixelScaleRatio*(-140f*toMm),line.Vertices[j].Z+7f);
			  }
			}
			Gl.glEnd();
			Gl.glPointSize(0.4f*TcData.PixelScaleRatio);//point is slightly smaller since no antialiasing
			Gl.glColor3f(
				(float)toothGraphic.colorWatch.R/255f,
				(float)toothGraphic.colorWatch.G/255f,
				(float)toothGraphic.colorWatch.B/255f);
			Gl.glBegin(Gl.GL_POINTS);
			for(int j=0;j<line.Vertices.Count;j++) {//loop through each vertex and render the colored W points.
			  if(ToothGraphic.IsMaxillary(toothGraphic.ToothID)){
			    Gl.glVertex3f(line.Vertices[j].X+TcData.PixelScaleRatio*(-6f*toMm),line.Vertices[j].Y+TcData.PixelScaleRatio*(150f*toMm),line.Vertices[j].Z+6f);
			  }
			  else{
			    Gl.glVertex3f(line.Vertices[j].X+TcData.PixelScaleRatio*(-6f*toMm),line.Vertices[j].Y+TcData.PixelScaleRatio*(-140f*toMm),line.Vertices[j].Z+6f);
			  }
			}
			Gl.glEnd();
			Gl.glPopMatrix();
		}
Exemplo n.º 21
0
		private Material GetGroupMaterial(ToothGraphic toothGraphic,ToothGroup group){
			Material material=new Material();
			Color materialColor;
			if(toothGraphic.ShiftO<-10) {//if unerupted
				materialColor=Color.FromArgb(group.PaintColor.A/2,group.PaintColor.R/2,group.PaintColor.G/2,group.PaintColor.B/2);
			} else {
				materialColor=group.PaintColor;
			}
			material.Ambient=materialColor;
			material.Diffuse=materialColor;
			if(group.GroupType==ToothGroupType.Cementum) {
				material.Specular=specular_color_cementum;
			} else if(group.PaintColor.R>245&&group.PaintColor.G>245&&group.PaintColor.B>235) {
				//because DirectX washes out the specular on the enamel, we have to turn it down only for the enamel color
				//for reference, this is the current enamel color: Color.FromArgb(255,250,250,240)
				float specEnamel=.4f;
				material.Specular=Color.FromArgb(255,(int)(255*specEnamel),(int)(255*specEnamel),(int)(255*specEnamel));
			} else {
				material.Specular=specular_color_normal;
			}
			material.SpecularSharpness=specularSharpness;
			return material;
		}
Exemplo n.º 22
0
		///<summary></summary>
		private void DrawTooth(ToothGraphic toothGraphic) {
			Gl.glEnable(Gl.GL_LIGHTING);
			Gl.glEnable(Gl.GL_BLEND);
			Gl.glEnable(Gl.GL_DEPTH_TEST);
			ToothGroup group;
			float[] material_color;
			for(int g=0;g<toothGraphic.Groups.Count;g++) {
				group=(ToothGroup)toothGraphic.Groups[g];
				if(group.GroupType==ToothGroupType.Buildup) {
					continue;
				}
				if(group.GroupType==ToothGroupType.None) {
					continue;
				}
				if(!group.Visible) {
					continue;
				}
				//group.PaintColor=Color.FromArgb(255,255,253,209);//temp only for testing
				if(toothGraphic.ShiftO<-10){//if unerupted
					material_color=new float[] {
						(float)group.PaintColor.R/255f/2f,
						(float)group.PaintColor.G/255f/2f,
						(float)group.PaintColor.B/255f/2f,
						(float)group.PaintColor.A/255f/2f
					};
				}
				else{
					material_color=new float[] {
						(float)group.PaintColor.R/255f,
						(float)group.PaintColor.G/255f,
						(float)group.PaintColor.B/255f,
						(float)group.PaintColor.A/255f
					};
				}
				if(group.GroupType==ToothGroupType.Cementum) {
					Gl.glMaterialfv(Gl.GL_FRONT,Gl.GL_SPECULAR,specular_color_cementum);
				}
				else {
					Gl.glMaterialfv(Gl.GL_FRONT,Gl.GL_SPECULAR,specular_color_normal);
				}
				Gl.glMaterialfv(Gl.GL_FRONT,Gl.GL_SHININESS,shininess);
				Gl.glMaterialfv(Gl.GL_FRONT,Gl.GL_AMBIENT_AND_DIFFUSE,material_color);
				Gl.glBlendFunc(Gl.GL_ONE,Gl.GL_ZERO);
				Gl.glHint(Gl.GL_POLYGON_SMOOTH_HINT,Gl.GL_NICEST);
				Gl.glListBase(displayListOffset);
				//draw the group
				Gl.glCallList(displayListOffset+toothGraphic.GetIndexForDisplayList(group));
			}
		}
Exemplo n.º 23
0
		private void DrawTooth(ToothGraphic toothGraphic) {
			ToothGroup group;
			device.VertexFormat=CustomVertex.PositionNormal.Format;
			device.SetStreamSource(0,toothGraphic.vb,0);
			for(int g=0;g<toothGraphic.Groups.Count;g++) {
				group=(ToothGroup)toothGraphic.Groups[g];
				if(!group.Visible || group.facesDirectX==null || 
					group.GroupType==ToothGroupType.Buildup || group.GroupType==ToothGroupType.None) {
					continue;
				}
				device.Material=GetGroupMaterial(toothGraphic,group);
				//draw the group
			  device.Indices=group.facesDirectX;
				device.DrawIndexedPrimitives(PrimitiveType.TriangleList,0,0,toothGraphic.VertexNormals.Count,0,group.NumIndicies/3);
			}
		}
Exemplo n.º 24
0
		//This step usually happens when the DrawMode property is set on the tooth chart wrapper, by way of the ResetControls() function.
		///<summary>Not normally used unless we are just trying to make a copy of an existing directX control.</summary>
		//public void InitializeDirectXGraphics() {
		//  toothChartDirectX.InitializeGraphics();
		//}

		#region Public Methods

		///<summary>If ListToothGraphics is empty, then this fills it, including the complex process of loading all drawing points from local resources.  Or if not empty, then this resets all 32+20 teeth to default postitions, no restorations, etc. Primary teeth set to visible false.  Also clears selected.  Should surround with SuspendLayout / ResumeLayout.</summary>
		public void ResetTeeth() {
			//selectedTeeth=new string[0];
			//this will only happen once when program first loads.  Unfortunately, there is no way to tell what the drawMode is going to be when loading the graphics from the file.  So any other initialization must happen in resetControls.
			if(tcData.ListToothGraphics.Count==0) {
				tcData.ListToothGraphics.Clear();
				ToothGraphic tooth;
				for(int i=1;i<=32;i++) {
					tooth=new ToothGraphic(i.ToString());
					tooth.Visible=true;
					tcData.ListToothGraphics.Add(tooth);
					//primary
					if(Tooth.PermToPri(i.ToString())!="") {
						tooth=new ToothGraphic(Tooth.PermToPri(i.ToString()));
						tooth.Visible=false;
						tcData.ListToothGraphics.Add(tooth);
					}
				}
				tooth=new ToothGraphic("implant");
				tcData.ListToothGraphics.Add(tooth);
			}
			else {//list was already initially filled, but now user needs to reset it.
				for(int i=0;i<tcData.ListToothGraphics.Count;i++) {//loop through all perm and pri teeth.
					tcData.ListToothGraphics[i].Reset();
				}
			}
			tcData.SelectedTeeth.Clear();
			tcData.DrawingSegmentList=new List<ToothInitial>();
			tcData.PointList=new List<Point>();
			Invalidate();
		}
Exemplo n.º 25
0
		private void DrawOcclusalView(ToothGraphic toothGraphic,Graphics g) {
			//now the occlusal surface. Absolute pixels instead of mm relative to center.
			float x,y;
			x=TcData.GetTransXpix(toothGraphic.ToothID);
			y=TcData.GetTransYocclusalPix(toothGraphic.ToothID);
			if(toothGraphic.Visible//might not be visible if an implant
				|| (toothGraphic.IsCrown && toothGraphic.IsImplant)//a crown on an implant will paint
			//pontics won't paint, because tooth is invisible
				//but, unlike the regular toothchart, we do want pontics to paint here
				|| toothGraphic.IsPontic) {
				DrawToothOcclusal(toothGraphic,g);
			}
			if(toothGraphic.Visible && 
				toothGraphic.IsSealant) {//draw sealant
				//?
			}
		}