public void GetData(Geometry geometry) { this.geometry = geometry; GeoVertex[] geoVertices = geometry.GeoVertices(); vertices = new VertexUnit[geoVertices.Length]; for (int i = 0; i < geoVertices.Length; i++) { vertices[i] = geoVertices[i].VertexUnit(); } Radius0 = vertices[0].Position().z; Radius1 = vertices[1].Position().z; Radius2 = vertices[2].Position().z; if (vertices.Length == 4) { Radius3 = vertices[3].Position().z; } else { Radius3 = Radius0; } geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>(); geoEdges = new List <GeoEdge>(); }
public void Init(GeoUI geoUI, GeoController geoController) { recognizePanel = geoUI.recognizePanel; navPanel = geoUI.navPanel; geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>(); this.geoController = geoController; }
void Start() { geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>(); navigationBehaviour = GameObject.Find("/3D/Navigation").GetComponent <NavigationBehaviour>(); gridBehaviour = GameObject.Find("/3D/Grid").GetComponent <GridBehaviour>(); coordinateBehaviour = GameObject.Find("/3D/Coordinate").GetComponent <CoordinateBehaviour>(); geoCamera = GameObject.Find("/3D/GeoCamera").GetComponent <GeoCamera>(); navCamera = GameObject.Find("/3D/NavCamera").GetComponent <NavCamera>(); InitTouchSystem(); InitView(); InitUI(); geoCamera.InitDefault(); stateController = GetComponent <StateController>(); stateController.Init(geoUI.statePanel); toolController = GetComponent <ToolController>(); toolController.Init(geoUI.toolPanel); recognizeController = GetComponent <RecognizeController>(); recognizeController.Init(geoUI.writingPanel); ClearGeometry(); }
public void Init(GeoCircular geoCircular, GeoCamera camera) { geoController = GameObject.Find("/GeoController").GetComponent <GeoController>(); geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>(); geoCamera = camera; geoCamera.OnRotate += OnCameraRotate; this.geoCircular = geoCircular; mesh = new Mesh(); colliderMesh = new Mesh(); MeshFilter meshFilter = gameObject.AddComponent <MeshFilter>(); meshRenderer = gameObject.AddComponent <MeshRenderer>(); meshCollider = gameObject.AddComponent <MeshCollider>(); meshFilter.sharedMesh = mesh; meshCollider.sharedMesh = colliderMesh; meshFilter.sharedMesh = mesh; SetColorIndex(0); SetStyleIndex(0); StyleManager.OnStyleChange += () => { SetColorIndex(0); SetStyleIndex(0); }; visiable = true; }
private void Resolve() { GeometryBehaviour geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>(); if (rectangleCondition != null) { Vector2 position = new Vector2(rectangleCondition.height, rectangleCondition.width); Vector3[] points = new Vector3[4]; points[0] = new Vector3(0, position.x / 2, 0); points[1] = new Vector3(0, -position.x / 2, 0); points[2] = new Vector3(0, -position.x / 2, position.y); points[3] = new Vector3(0, position.x / 2, position.y); geometry.SetRectangle(points); geometryBehaviour.InitGeometry(geometry); geometrySetted = true; } if (triangleCondition != null) { Vector2 position = new Vector2(triangleCondition.height, triangleCondition.width); Vector3[] points = new Vector3[3]; points[0] = new Vector3(0, position.x / 2, 0); points[1] = new Vector3(0, -position.x / 2, 0); points[2] = new Vector3(0, -position.x / 2, position.y); geometry.SetTriangle(points); geometryBehaviour.InitGeometry(geometry); geometrySetted = true; } }
public VertexCoordinateOperation(GeoController geoController, StateController stateController, Geometry geometry, GeometryBehaviour geometryBehaviour, GeoUI geoUI, VertexUnit vertexUnit) { CanRotateCamera = true; CanActiveElement = false; this.geoController = geoController; this.stateController = stateController; this.geometry = geometry; this.geometryBehaviour = geometryBehaviour; this.inputPanel = geoUI.inputPanel; this.vertexUnit = vertexUnit; }
public EditEdgeOperation(GeoController geoController, GeoCamera geoCamera, Geometry geometry, GeometryBehaviour geometryBehaviour, GeoUI geoUI, GeoEdge geoEdge) { CanRotateCamera = false; CanActiveElement = false; this.geoController = geoController; this.geoCamera = geoCamera; this.geometry = geometry; this.geometryBehaviour = geometryBehaviour; this.activePanel = geoUI.activePanel; this.elementPanel = geoUI.elementPanel; this.geoEdge = geoEdge; }
public EditVertexOperation(GeoController geoController, StateController stateController, GeoCamera geoCamera, Geometry geometry, GeometryBehaviour geometryBehaviour, GeoUI geoUI, GeoVertex geoVertex) { CanRotateCamera = false; CanActiveElement = false; this.geoController = geoController; this.stateController = stateController; this.geoCamera = geoCamera; this.geometry = geometry; this.geometryBehaviour = geometryBehaviour; this.activePanel = geoUI.activePanel; this.elementPanel = geoUI.elementPanel; this.geoVertex = geoVertex; }
public GeometryOperation(GeoController geoController, ToolController toolController, StateController stateController, Tool tool, GeometryBehaviour geometryBehaviour) { this.geoController = geoController; this.toolController = toolController; this.stateController = stateController; this.tool = tool; this.geometryBehaviour = geometryBehaviour; Type type = Type.GetType(tool.Name + "GeometryTool"); if (type != null) { geometryTool = (GeometryTool)Activator.CreateInstance(type); } }
public MoveVertexOperation(StateController stateController, GeoCamera geoCamera, Geometry geometry, GeometryBehaviour geometryBehaviour, GeoUI geoUI, VertexUnit vertex, VertexBehaviour vertexBehaviour, bool snap) { CanRotateCamera = false; CanActiveElement = false; this.stateController = stateController; this.geoCamera = geoCamera; this.geometry = geometry; this.geometryBehaviour = geometryBehaviour; this.inputPanel = geoUI.inputPanel; this.vertex = vertex; this.vertexBehaviour = vertexBehaviour; this.snap = snap; }
public AddAuxiliaryOperation(GeoController geoController, StateController stateController, Geometry geometry, GeometryBehaviour geometryBehaviour, GeoUI geoUI, Tool tool) { CanRotateCamera = true; CanActiveElement = true; this.geoController = geoController; this.stateController = stateController; this.geometry = geometry; this.geometryBehaviour = geometryBehaviour; this.inputPanel = geoUI.inputPanel; this.tool = tool; Type type = Type.GetType(tool.Name + "AuxiliaryTool"); if (type != null) { auxiliaryTool = (AuxiliaryTool)Activator.CreateInstance(type); } }
public void GenerateResolvedBody(Geometry geometry) { SpinAuxiliary auxiliary = new SpinAuxiliary(); auxiliary.InitWithGeometry(geometry); geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>(); VertexUnit[] vertexUnits = auxiliary.vertices; // Cylinder if (vertexUnits.Length == 4) { VertexUnit vertex1 = vertexUnits[0]; VertexUnit vertex2 = vertexUnits[1]; VertexUnit vertex3 = vertexUnits[2]; VertexUnit vertex4 = vertexUnits[3]; float radius1 = vertexUnits[3].Position().z; float radius2 = vertexUnits[2].Position().z; GeoCircular circular = new GeoCircular(new VertexUnit[] { vertex1, vertex2, vertex3, vertex4 }, radius1, radius2, CircularType.Cylinder); geometry.AddGeoCircular(circular); VertexSpace circle1 = new VertexSpace(0, vertex4.Position().y, 0); VertexSpace circle2 = new VertexSpace(0, vertex3.Position().y, 0); geometry.AddGeoCircle(new GeoCircle(circle1, radius1, CircleDirection.Y, false, FaceType.SpreadCylinderCircle)); geometry.AddGeoCircle(new GeoCircle(circle2, radius2, CircleDirection.Y, false, FaceType.SpreadCylinderCircle)); } // Cone else if (vertexUnits.Length == 3) { VertexUnit vertex1 = vertexUnits[0]; VertexUnit vertex2 = vertexUnits[1]; VertexUnit vertex3 = vertexUnits[2]; float radius = vertexUnits[2].Position().z; GeoCircular circular = new GeoCircular(new VertexUnit[] { vertex1, vertex2, vertex3 }, radius, radius, CircularType.Cone); geometry.AddGeoCircular(circular); VertexSpace circle1 = new VertexSpace(0, vertex3.Position().y, 0); geometry.AddGeoCircle(new GeoCircle(circle1, radius, CircleDirection.Y, false, FaceType.SpreadConeCircle)); } geometryBehaviour.InitGeometry(geometry); StatusButton lockButton = GameObject.Find("LockButton").GetComponent <StatusButton>(); lockButton.SetStatus(0); }
public void Init(GeoCircle geoCircle) { this.geoCircle = geoCircle; visiable = true; geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>(); }
public SpreadAuxiliary() : base() { geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>(); geoCamera = GameObject.Find("/3D/GeoCamera").GetComponent <GeoCamera>(); }
// private geometryBehaviour; public SpinAuxiliary() : base() { geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>(); }
public void SetSpreadFaceStyle(GeoElement element, int i) { GeoFace geoFace; if (element is GeoFace) { geoFace = (GeoFace)element; } else { return; } this.SetElementColor(element, i); GeometryBehaviour geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>(); switch (geoFace.faceType) { case FaceType.Normal: break; case FaceType.SpreadRectangle: case FaceType.SpreadFan: for (int index = 0; index < geoCirculars.Count; index++) { GeoCircular circular = geoCirculars[0]; this.SetElementColor(circular, i); geometryBehaviour.GeometryElementColorChange(circular, i); } break; case FaceType.SpreadCylinderCircle: case FaceType.SpreadConeCircle: Vector3[] vectors = geoFace.Face().Vertices; if (vectors.Length == 0) { break; } Vector3 v = (vectors[0] + vectors[vectors.Length / 2]) / 2; Dictionary <GeoElement, ElementBehaviour> elementMap = geometryBehaviour.GetGeoElements(); GeoFace face; foreach (GeoElement key in elementMap.Keys) { if (key is GeoFace) { face = (GeoFace)key; if (geoFace.faceType == face.faceType) { if (face.faceType == FaceType.SpreadCylinderCircle) { vectors = face.Face().Vertices; if (vectors.Length == 0) { continue; } Vector3 tmp = (vectors[0] + vectors[vectors.Length / 2]) / 2; if ((tmp.y > 0 && v.y > 0) || (tmp.y < 0 && v.y < 0)) { this.SetElementColor(face, i); geometryBehaviour.GeometryElementColorChange(face, i); } } if (face.faceType == FaceType.SpreadConeCircle) { this.SetElementColor(face, i); geometryBehaviour.GeometryElementColorChange(face, i); } } } } break; } }