/// <summary> /// Initializes a new instance of the <see cref="Line3DVisualizationObject"/> class. /// </summary> public Line3DVisualizationObject() { this.line3D = new PipeVisual3D(); this.UpdateLineProperties(); this.UpdateVisibility(); }
private void UpdateLinePosition(Visual3D visual, Point3D point1, Point3D point2) { PipeVisual3D line = visual as PipeVisual3D; line.Point1 = point1; line.Point2 = point2; }
public RotationForme() { Cylindre = new PipeVisual3D(); InitializeComponent(); viewport.Children.Add(Cylindre); RotateManipulator rotateManipulatorX = new RotateManipulator(); rotateManipulatorX.Visibility = Visibility.Visible; rotateManipulatorX.Bind(Cylindre); rotateManipulatorX.Color = Colors.Aqua; rotateManipulatorX.Axis = new Vector3D(-10, 0, 0); rotateManipulatorX.Pivot = Cylindre.Point2; viewport.Children.Add(rotateManipulatorX); RotateManipulator rotateManipulatorY = new RotateManipulator(); rotateManipulatorY.Visibility = Visibility.Visible; rotateManipulatorY.Bind(Cylindre); rotateManipulatorY.Color = Colors.Aqua; rotateManipulatorY.Axis = new Vector3D(0, -10, 0); rotateManipulatorY.Pivot = Cylindre.Point2; viewport.Children.Add(rotateManipulatorY); RotateManipulator rotateManipulatorZ = new RotateManipulator(); rotateManipulatorZ.Visibility = Visibility.Visible; rotateManipulatorZ.Bind(Cylindre); rotateManipulatorZ.Color = Colors.Aqua; rotateManipulatorZ.Axis = new Vector3D(0, 0, -10); rotateManipulatorZ.Pivot = Cylindre.Point2; viewport.Children.Add(rotateManipulatorZ); }
private void CreateLine3D() { // Create the edges this.line3D = new PipeVisual3D() { ThetaDiv = PipeDiv }; // Set the color, thickness, opacity this.UpdateLineProperties(); }
private PipeVisual3D CreateLine(Point3D start, Point3D end) { var line = new PipeVisual3D(); line.Point1 = start; line.Point2 = end; line.InnerDiameter = 0; line.Diameter = 0.05; line.Fill = Brushes.LightGray; return(line); }
/// <summary> /// Creates a pipe (bone) between two joints /// </summary> /// <param name="firstJoint">the first joint(end) of the bone </param> /// <param name="lastJoint">the second joint(end) of the bone</param> /// <returns>a list with initialized bones</returns> private PipeVisual3D createBones(Point3D firstJoint, Point3D lastJoint) { PipeVisual3D pipe = new PipeVisual3D(); Material mat = new DiffuseMaterial(new SolidColorBrush(Colors.Green)); pipe.Diameter = 0.07f; pipe.InnerDiameter = 0.00f; pipe.ThetaDiv = 3; pipe.Point1 = firstJoint; pipe.Point2 = lastJoint; pipe.Material = mat; return(pipe); }
public void CreateRack(string gr, string type, MouseButtonEventArgs e, double centerz, double centery) { PipeVisual3D pipe = new PipeVisual3D(); pipe.Diameter = 1; pipe.Point1 = new Point3D(0, 0, 0); pipe.Point2 = new Point3D(1, 0, 0); MeshElement3D tpipe = pipe as MeshElement3D; tpipe.Model.Material = Materials.White; ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(@"Images//Задняя стена белый.jpg", UriKind.Relative))); tpipe.Model.Material = new DiffuseMaterial(texture); ModelUIElement3D modelUI = new ModelUIElement3D(); modelUI.MouseUp += win.ClickOnModel; modelUI.Model = tpipe.Model; ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0); tempmodel.groupel = gr; tempmodel.ingroupel = "Rack"; tempmodel.objgr = "S"; tempmodel.thickness = 0.015; tempmodel.select = win.CreatedElements[win.selectedobject.GetHashCode()] as ElementCabinet; if (win.twoselectedobject != null) { tempmodel.twoselect = win.CreatedElements[win.twoselectedobject.GetHashCode()] as ElementCabinet; } if (type == "L") { tempmodel.napr = 1; } if (type == "R") { tempmodel.napr = -1; } tempmodel.hashtable = win.CreatedElements; tempmodel.center = centerz - tempmodel.select.AxisZ; tempmodel.centery = centery - tempmodel.select.AxisY; tempmodel.changeTexture(win.soureseDefault, win.iddefault); _3DObject tempmodel1 = win.CreatedElements[win.selectedobject.GetHashCode()] as _3DObject; Transform3DGroup group3d = tempmodel1.thismodel.Transform as Transform3DGroup; ScaleTransform3D tln = group3d.Children.OfType <ScaleTransform3D>().FirstOrDefault(); tempmodel.changeObject(0, tln.ScaleY, 0, 0, 0, 0); win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel); win.container.Children.Add(modelUI); win.ClickOnCamera(modelUI, e as MouseButtonEventArgs); win.ClickOnModel(modelUI, e); }
public RodUI(Rod rod) : base(rod) { var rodVisual = new PipeVisual3D(); rodVisual.Point1 = rod.Vertices[0].Point.Multiply(SCALE_FACTOR); rodVisual.Point2 = rod.Vertices[1].Point.Multiply(SCALE_FACTOR); //rodVisual.Diameter = 0.001f; VisualElement = rodVisual; var colorMaterial = MaterialHelper.CreateMaterial(Brushes.Blue); var groupMaterial = new MaterialGroup(); groupMaterial.Children.Add(colorMaterial); Material = groupMaterial; Title = "Стержень №" + rod.Number; }
private void AddBases(ModelVisual3D model, int number, double turns, double length) { var b = turns * 2 * Math.PI; var l = length; var p1 = 0d; var p2 = 3.14; for (int i = 0; i < number; i++) { var u = (double)i / (number - 1); var bu = b * u; var x1 = Math.Cos(bu + p1) + Math.Cos(bu + p1); var y1 = Math.Sin(bu + p1) + Math.Sin(bu + p1); var z = u * l; var x2 = Math.Cos(bu + p2) + Math.Cos(bu + p2); var y2 = Math.Sin(bu + p2) + Math.Sin(bu + p2); var pt1 = new Point3D(x1, y1, z); var pt2 = new Point3D(x2, y2, z); var pt3 = new Point3D(0, 0, z); var j = r.Next(4); var brush1 = BaseBrush1[j]; var brush2 = BaseBrush2[j]; var ts = new PipeVisual3D { Point1 = pt1, Point2 = pt3, Diameter = 0.4, Material = MaterialHelper.CreateMaterial(brush1) }; model.Children.Add(ts); var ts2 = new PipeVisual3D { Point1 = pt3, Point2 = pt2, Diameter = 0.4, Material = MaterialHelper.CreateMaterial(brush2) }; model.Children.Add(ts2); } }
public void CreateRackEl(string groupel, string ingroupel, string objgr, double AxisX, double AxisY, double AxisZ, double LenX, double LenY, double LenZ, double thickness, ModelUIElement3D thisobject1, ModelUIElement3D thisobject2, int napr, double center, double centery, ArrayList conttemp, string text = "-1", int id = -1) { if (text == "-1") { text = win.soureseDefault; } if (id == -1) { id = win.iddefault; } PipeVisual3D pipe = new PipeVisual3D(); pipe.Diameter = 1; pipe.Point1 = new Point3D(0, 0, 0); pipe.Point2 = new Point3D(1, 0, 0); MeshElement3D tpipe = pipe as MeshElement3D; tpipe.Model.Material = Materials.White; ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(text, UriKind.Relative))); tpipe.Model.Material = new DiffuseMaterial(texture); ModelUIElement3D modelUI = new ModelUIElement3D(); modelUI.MouseUp += win.ClickOnModel; modelUI.Model = tpipe.Model; ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0); tempmodel.groupel = groupel; tempmodel.ingroupel = ingroupel; tempmodel.objgr = objgr; tempmodel.thickness = thickness; tempmodel.select = win.CreatedElements[thisobject1.GetHashCode()] as ElementCabinet; tempmodel.twoselect = win.CreatedElements[thisobject2.GetHashCode()] as ElementCabinet; tempmodel.napr = -1; tempmodel.hashtable = win.CreatedElements; tempmodel.center = center; tempmodel.centery = centery; tempmodel.changeObject(LenX, LenY, LenZ, AxisX, AxisY, AxisZ); win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel); win.container.Children.Add(modelUI); conttemp.Add(modelUI); tempmodel.changeTexture(text, id); }
public DeplacementForme() { Cylindre = new PipeVisual3D(); InitializeComponent(); viewport.Children.Add(Cylindre); Cylindre.Point2 = new Point3D(0, 0, -10); // Translate X TranslateManipulator translateManipulatorX = new TranslateManipulator(); translateManipulatorX.Visibility = Visibility.Visible; translateManipulatorX.Bind(Cylindre); translateManipulatorX.Color = Colors.DarkRed; translateManipulatorX.Direction = new Vector3D(1, 0, 0); viewport.Children.Add(translateManipulatorX); // Translate Y TranslateManipulator translateManipulatorY = new TranslateManipulator(); translateManipulatorY.Visibility = Visibility.Visible; translateManipulatorY.Bind(Cylindre); translateManipulatorY.Color = Colors.AliceBlue; translateManipulatorY.Direction = new Vector3D(0, 1, 0); viewport.Children.Add(translateManipulatorY); // Translate Z TranslateManipulator translateManipulatorZ = new TranslateManipulator(); translateManipulatorZ.Visibility = Visibility.Visible; translateManipulatorZ.Bind(Cylindre); translateManipulatorZ.Color = Colors.ForestGreen; translateManipulatorZ.Direction = new Vector3D(0, 0, -1); viewport.Children.Add(translateManipulatorZ); //translateManipulatorX.MouseUp += MouseUpHandler; //translateManipulatorY.MouseUp += MouseUpHandler; //translateManipulatorZ.MouseUp += MouseUpHandler; }
/// <summary> /// initializes the bones for a body with the provided number, lists for the midsection and other joints provided /// by the kinect camera /// </summary> /// <param name="bodyNr">the number of the body which will be initialized</param> /// <param name="pList">the list of joints without the midsection</param> /// <param name="midSection">the list of midsection joints</param> private void initBodyBones(int bodyNr, List <Point3D> pList, List <Point3D> midSection) { //from right to center; for (int i = 0; i < 4; i++) { boneListsList[bodyNr].Add(createBones(pList[i], pList[i + 1])); skelList[bodyNr].Children.Add(boneListsList[bodyNr][i]); } for (int i = 4; i < 8; i++) { boneListsList[bodyNr].Add(createBones(pList[i], pList[i + 1])); skelList[bodyNr].Children.Add(boneListsList[bodyNr][i]); } //head to center hip for (int i = 8; i < 11; i++) { boneListsList[bodyNr].Add(createBones(midSection[i - 8], midSection[i - 8 + 1])); skelList[bodyNr].Children.Add(boneListsList[bodyNr][i]); } //from right foot to center for (int i = 11; i < 15; i++) { boneListsList[bodyNr].Add(createBones(pList[i], pList[i + 1])); skelList[bodyNr].Children.Add(boneListsList[bodyNr][i]); } //from left foot to center for (int i = 15; i < 19; i++) { boneListsList[bodyNr].Add(createBones(pList[i], pList[i + 1])); skelList[bodyNr].Children.Add(boneListsList[bodyNr][i]); } skelRayList[bodyNr] = new PipeVisual3D(); skelRayList[bodyNr].Diameter = 0.07f; skelRayList[bodyNr].InnerDiameter = 0.00f; skelRayList[bodyNr].ThetaDiv = 3; boneListInitList[bodyNr] = true; mainViewport.Children.Add(skelList[bodyNr]); }
public void Initialize() { RodLength = defaultRodLength; CartLinkPoint = new Point3D(0.0, 0.0, platformHeight); MassLinkPoint = new Point3D(0.0, 0.0, platformHeight + RodLength); Model = new ModelVisual3D(); massModel = new SphereVisual3D(); massModel.Radius = 0.5; massModel.Fill = Brushes.Gold; massModel.Center = MassLinkPoint; Model.Children.Add(massModel); rodModel = new PipeVisual3D(); rodModel.Diameter = rodDiameter; rodModel.Fill = Brushes.Gold; rodModel.Point1 = CartLinkPoint; rodModel.Point2 = MassLinkPoint; Model.Children.Add(rodModel); }