}/* * C3DPoint newPt = pt; * newPt.Offset(OrigineCliente.X, OrigineCliente.Y, OrigineCliente.Z); * newPt.Offset(Position.X, Position.Y, Position.Z); * if (Parent != null) * return Parent.ClientToGlobal(newPt); * else * return newPt; * }*/ //-------------------------------------- public C3DPoint GlobalToClient(C3DPoint pt) { CTransformation3D t = CTransformation3D.Identity; PushTransformationGlobalToChild(t); return(t.Transforme(pt)); }
public C3DPoint Transforme(C3DPoint point) { CVecteur3D vecteur = new CVecteur3D(point.X, point.Y, point.Z, 1.0); vecteur = this * vecteur; return(new C3DPoint((int)vecteur[0], (int)vecteur[1], (int)vecteur[2])); }
//-------------------------------------- public C3DPoint ClientToGlobal(C3DPoint pt) { CTransformation3D t = CTransformation3D.Identity; PushTransformationChildToGlobal(t); return(t.Transforme(pt)); }/*
//----------------------------------------------- public Point ConvertTo2D(C3DPoint pt) { switch (FaceVisible) { default: case EFaceVueDynamique.Front: return(new Point(pt.X, pt.Y)); case EFaceVueDynamique.Left: return(new Point( pt.Z, pt.Y)); case EFaceVueDynamique.Top: return(new Point( pt.X, pt.Z)); case EFaceVueDynamique.Rear: return(new Point( pt.X, pt.Y)); case EFaceVueDynamique.Right: return(new Point( pt.Z, pt.Y)); case EFaceVueDynamique.Bottom: return(new Point( pt.X, pt.Z)); } }
//-------------------------------------------------- public C3DPrimitiveQuad(C3DPoint point1, C3DPoint point2, C3DPoint point3, C3DPoint point4, Color couleur) { m_points = new C3DPoint[4] { point1, point2, point3, point4 }; m_couleur = couleur; }
//----------------------------------------------- public C3DPoint ConvertTo3D(Point pt, C3DPoint dimensionsManquantes) { C3DPoint pt3D = new C3DPoint(); switch (FaceVisible) { case EFaceVueDynamique.Front: pt3D = new C3DPoint( pt.X, pt.Y, dimensionsManquantes.Z); break; case EFaceVueDynamique.Left: pt3D = new C3DPoint( dimensionsManquantes.X, pt.Y, pt.X); break; case EFaceVueDynamique.Top: pt3D = new C3DPoint( pt.X, dimensionsManquantes.Y, pt.Y); break; case EFaceVueDynamique.Rear: pt3D = new C3DPoint( pt.X, pt.Y, dimensionsManquantes.Z); break; case EFaceVueDynamique.Right: pt3D = new C3DPoint( dimensionsManquantes.X, pt.Y, pt.X); break; case EFaceVueDynamique.Bottom: m_composant3D.Position = new C3DPoint( pt.X, dimensionsManquantes.Y, pt.Y); break; default: break; } return(pt3D); }
//----------------------------------------------- public System.Drawing.Point GlobalToClient(System.Drawing.Point pt, C3DPoint dimensionManquante) { C2i3DEn2D parent = this; while (parent.Parent != null) { parent = parent.Parent as C2i3DEn2D; } C3DPoint pt3D = parent.ConvertTo3D(pt, dimensionManquante); pt3D = m_composant3D.GlobalToClient(pt3D); return(ConvertTo2D(pt3D)); }
//----------------------------------------------- public Point ClientToGlobal(Point pt, C3DPoint dimensionsManquantes) { C3DPoint pt3D = ConvertTo3D(pt, dimensionsManquantes); pt3D = m_composant3D.ClientToGlobal(pt3D); C2i3DEn2D parent = this; while (parent.Parent != null) { parent = parent.Parent as C2i3DEn2D; } return(parent.ConvertTo2D(pt3D)); }
//----------------------------------------------------- private void DockChilds() { if (m_bIsDocking) { return; } m_bIsDocking = true; C3DPoint offset = new C3DPoint(0, 0, 0); C3DSize size = Size; foreach (C2iComposant3D composantFils in Childs) { CDockStyle dockStyle = composantFils.LocationInParent as CDockStyle; if (dockStyle != null) { switch (dockStyle.DockStyle) { case E3DDockStyle.Top: composantFils.Size = new C3DSize( size.With, composantFils.Size.Height, size.Depth); composantFils.Position = new C3DPoint( offset.X, offset.Y + size.Height - composantFils.Size.Height, offset.Z); size.Inflate( 0, -composantFils.Size.Height, 0); break; case E3DDockStyle.Bottom: composantFils.Size = new C3DSize( size.With, composantFils.Size.Height, size.Depth); composantFils.Position = new C3DPoint( offset.X, offset.Y, offset.Z); size.Inflate( 0, -composantFils.Size.Height, 0); offset.Offset( 0, composantFils.Size.Height, 0); break; case E3DDockStyle.Left: composantFils.Size = new C3DSize( composantFils.Size.With, size.Height, size.Depth); composantFils.Position = new C3DPoint( offset.X, offset.Y, offset.Z); size.Inflate( -composantFils.Size.With, 0, 0); offset.Offset( composantFils.Size.With, 0, 0); break; case E3DDockStyle.Right: composantFils.Size = new C3DSize( composantFils.Size.With, size.Height, size.Depth); composantFils.Position = new C3DPoint( offset.X + size.With - composantFils.Size.With, offset.Y, offset.Z); size.Inflate( -composantFils.Size.With, 0, 0); break; case E3DDockStyle.Back: composantFils.Size = new C3DSize( size.With, size.Height, composantFils.Size.Depth); composantFils.Position = new C3DPoint( offset.X, offset.Y, offset.Z); size.Inflate(0, 0, -composantFils.Size.Depth); offset.Offset(0, 0, composantFils.Size.Depth); break; case E3DDockStyle.Front: composantFils.Size = new C3DSize( size.With, size.Height, composantFils.Size.Depth); composantFils.Position = new C3DPoint( offset.X, offset.Y, offset.Z + size.Depth - composantFils.Size.Depth); size.Inflate( 0, 0, -composantFils.Size.Depth); break; case E3DDockStyle.Fill: composantFils.Position = offset; composantFils.Size = size; break; default: break; } } } m_bIsDocking = false; }
//-------------------------------------------------- public C3DPrimitiveCube(C3DPoint position, C3DSize size, Color couleur) { m_position = position; m_size = size; m_couleur = couleur; }