本文整理汇总了C#中Line.DrawTransform方法的典型用法代码示例。如果您正苦于以下问题:C# Line.DrawTransform方法的具体用法?C# Line.DrawTransform怎么用?C# Line.DrawTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line
的用法示例。
在下文中一共展示了Line.DrawTransform方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawFacialView
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();
}
//.........这里部分代码省略.........
示例2: DrawExtended3dLine
///<summary>Draws a line strip extending the two point lines which to not include endpoints.
///Set extendEndPoints to true to extend the endpoints of the line.</summary>
private void DrawExtended3dLine(Vector3[] points,float extendDist,bool extendEndPoints,Color color,float lineWidth,Matrix transform){
//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 p=0;p<points.Length-1;p++) {
twoPointLines.Add(points[p]);
twoPointLines.Add(p==0);
twoPointLines.Add(points[p+1]);
twoPointLines.Add(p==points.Length-2);
}
Line line=new Line(device);
line.Antialias=false;
line.Width=lineWidth;
line.Begin();
//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.
//Do not extend the endpoints for the ends of the line strips unless extendEndPoints=true.
if(!p1IsEndPoint || extendEndPoints) {
p1=p1-extendDist*lineDir;
}
//Do not extend the endpoints for the ends of the line strips unless extendEndPoints=true.
if(!p2IsEndPoint || extendEndPoints) {
p2=p2+extendDist*lineDir;
}
Vector3[] lineVerts=new Vector3[] { p1,p2 };
line.DrawTransform(lineVerts,transform,color);
}
line.End();
line.Dispose();
}
示例3: DrawNumbersAndLinesPerio
private void DrawNumbersAndLinesPerio(float baseY) {
device.RenderState.Lighting=false;
device.RenderState.ZBufferEnable=false;
//Draw the center line.
device.Transform.World=Matrix.Identity;
Matrix lineMatrix=ScreenSpaceMatrix();
Line centerLine=new Line(device);
centerLine.Width=2.5f;
centerLine.Antialias=false;
centerLine.Begin();//Must call Line.Begin() in order for Antialias=false to take effect.
centerLine.DrawTransform(new Vector3[] {
new Vector3(-65f,baseY,0),
new Vector3(65f,baseY,0)},
lineMatrix,
Color.Black);
centerLine.End();
//Draw the tooth numbers.
string tooth_id;
for(int i=1;i<=32;i++) {
tooth_id=Tooth.FromOrdinal(i);
//bool isSelected=TcData.SelectedTeeth.Contains(tooth_id);
float yOffset=ToothGraphic.IsMaxillary(tooth_id)?30:-29;
DrawNumber(tooth_id,false,baseY+yOffset);
}
}
示例4: DrawDrawingSegments
private void DrawDrawingSegments() {
device.RenderState.Lighting=false;
device.RenderState.ZBufferEnable=false;
device.Transform.World=Matrix.Identity;
Matrix lineMatrix=ScreenSpaceMatrix();
Line line=new Line(device);
line.Width=2.2f*TcData.PixelScaleRatio;
line.Begin();
for(int s=0;s<TcData.DrawingSegmentList.Count;s++) {
string[] pointStr=TcData.DrawingSegmentList[s].DrawingSegment.Split(';');
List<Vector3> points=new List<Vector3>();
for(int p=0;p<pointStr.Length;p++) {
string[] xy=pointStr[p].Split(',');
if(xy.Length==2) {
Point point=new Point((int)(float.Parse(xy[0])),(int)(float.Parse(xy[1])));
//if we set 0,0 to center, then this is where we would convert it back.
PointF pointMm=TcData.PointDrawingPixToMm(point);
points.Add(new Vector3(pointMm.X,pointMm.Y,0f));
}
}
//Convert each line strip into very simple two point lines so that line extensions can be calculated more easily below.
List<Vector3> twoPointLines=new List<Vector3>();
for(int j=0;j<points.Count-1;j++) {
twoPointLines.Add(new Vector3(
points[j].X,
points[j].Y,
points[j].Z));
twoPointLines.Add(new Vector3(
points[j+1].X,
points[j+1].Y,
points[j+1].Z));
}
//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.
//All lines are expanded on both sides here, because the drawing could end with a loop and the loop must be closed.
for(int j=0;j<twoPointLines.Count;j+=2){
Vector3 p1=(Vector3)twoPointLines[j];
Vector3 p2=(Vector3)twoPointLines[j+1];
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.
p1=p1-extSize*lineDir;
p2=p2+extSize*lineDir;
Vector3[] lineVerts=new Vector3[] {p1,p2};
line.DrawTransform(lineVerts,lineMatrix,TcData.DrawingSegmentList[s].ColorDraw);
}
//no filled circle at intersections
}
//Draw the points that make up the segment which is currently being drawn
//but which has not yet been sent to the database.
for(int p=1;p<TcData.PointList.Count;p++){
PointF pMm1=TcData.PointPixToMm(TcData.PointList[p]);
PointF pMm2=TcData.PointPixToMm(TcData.PointList[p-1]);
line.DrawTransform(new Vector3[] {
new Vector3(pMm1.X,pMm1.Y,0f),
new Vector3(pMm2.X,pMm2.Y,0f)},
lineMatrix,
TcData.ColorDrawing);
}
line.End();
line.Dispose();
}
示例5: DrawOrigin
/// <summary>
///
/// </summary>
private void DrawOrigin()
{
this.dxDevice.Transform.World = Matrix.Translation(0, 0, 0);
Matrix lineMatrix = this.dxDevice.Transform.World * this.dxDevice.Transform.View * this.dxDevice.Transform.Projection;
using (Line myLine = new Line(this.dxDevice))
{
// Set the width
myLine.Width = 1;
// Should they be antialiased?
myLine.Antialias = true;
// Draw the line
myLine.Begin();
myLine.DrawTransform(this.vtrOrigin, lineMatrix, Color.WhiteSmoke);
myLine.End();
} // End of using block
}