/// <summary> /// 获取正方体的每个面顶点坐标 /// </summary> /// <param name="count"></param> /// <returns></returns> protected virtual Vector3[] GetPointsVector3s(PointsInfo _points) { List <Vector3> tempPoints = new List <Vector3>(); return(tempPoints.ToArray()); }
On_execute() { WebResponse response = null; try { response = (HttpWebResponse)Create_request().GetResponse(); var balance = JSON.Deserialize_from_stream <PointsResponse>( new StreamReader(response.GetResponseStream())); _fetched_Points = new PointsInfo() { point_balance = balance != null ? balance.points : "0" }; } catch (WebException ex) { Handle_errors_if_present(ex); } finally { if (response != null) { response.Close(); } } }
public PointsInfo GetPointsInRange(PointsInfo pointsDetail) { Ensure_we_are_authenticated(); Get_Points_Detail_Request request = new Get_Points_Detail_Request(base_request_address_, pointsDetail, token_); request.Execute(); return(request.PointDetails); }
private Program program() { // PointsInfo points = point(); Block blocks = block(); return(new Program(points, blocks)); }
protected override Vector3[] GetPointsVector3s(PointsInfo _points) { List <Vector3> tempPoints = new List <Vector3>(); for (int i = 0; i < _points.points.Length; i++) { tempPoints.AddRange(GetCubePointFromPoint(new Vector3(_points.points[i].x, _points.points[i].y / 2f, _points.points[i].z), new Vector3(_points.size.x, _points.points[i].y, _points.size.z))); } return(tempPoints.ToArray()); }
/// <summary> /// 根据顶点和位移差获取最终位置 /// </summary> /// <param name="vertices"></param> /// <param name="index"></param> /// <returns></returns> public override Vector3[] SetVerticesOffset(Vector3[] vertices, PointsInfo _points) { Vector3[] tempV3 = new Vector3[vertices.Length]; for (int i = 0; i < vertices.Length; i++) { tempV3[i] = vertices[i]; tempV3[i] += _points.points[0]; } return(tempV3); }
protected override Vector3[] GetPointsVector3s(PointsInfo _points) { List <Vector3> tempPoints = new List <Vector3>(); for (int i = 1; i < _points.points.Length; i++) { Vector3 lastPoint = _points.points[i - 1]; Vector3 curPoint = _points.points[i]; tempPoints.AddRange(GetCubePointFromPoint(new Vector3((lastPoint.x + curPoint.x) / 2f, 0, (lastPoint.z + curPoint.z) / 2f), new Vector3(curPoint.x - lastPoint.x, _points.size.y, _points.size.z), i == 1, i == _points.points.Length - 1)); } return(tempPoints.ToArray()); }
public override Vector3[] SetVerticesOffset(Vector3[] vertices, PointsInfo _points) { List <Vector3> tempV3s = new List <Vector3>(); for (int i = 0; i < vertices.Length; i++) { for (int j = 0; j < _points.points.Length; j++) { if (vertices[i].x == _points.points[j].x) { vertices[i].y += _points.points[j].y; } if (!bottomExtension) { if (j != 0 && j != _points.points.Length - 1 && vertices[i].y == _points.points[j].y - _points.size.y / 2f) { Vector3 upPoint = vertices[i] + new Vector3(0, _points.size.y, 0); Vector3 midDir = (_points.points[j - 1] - _points.points[j]).normalized + (_points.points[j + 1] - _points.points[j]).normalized; Debug.DrawLine(upPoint, upPoint + midDir * 10, Color.red); // vertices[i] = upPoint +(_points.points[j].y< _points.points[j+1].y?-1:1)* _points.size.y * midDir.normalized; vertices[i] = LinePointProjection(vertices[i], upPoint, upPoint + midDir); } } else { if (vertices[i].y == _points.points[j].y - _points.size.y / 2f) { vertices[i].y = 0; } } } } return(vertices); }
public Get_Points_Detail_Request(string base_request_address, PointsInfo pointsInfo, Token token) : base(base_request_address, null, token) { _pointsInfo = pointsInfo; }
/// <summary> /// 获取正方体的每个面顶点坐标 (先绘出顶面第一个长方形,再绘制底面第一个长方形,依次连接长方体的面) /// </summary> /// <param name="count"></param> /// <returns></returns> protected Vector3[] GetPointsVector3s(PointsInfo _points, int index) { List <Vector3> tempPoints = new List <Vector3>(); //立方体初始的点,取内圆心 上表面的一个点 Vector3 firstUpPoint = new Vector3(_points.size.x * _points.inCirclePercent, -_points.size.y / 2f, 0); ///上表面的中心点 Vector3 centerUp = center + new Vector3(0, _points.size.y / 2f, 0); if (index == 0) { pieceAngle = 0; } else { pieceAngle += _points.itemSectorPercent[index - 1] * 360f; } nextAngle += _points.itemSectorPercent[index] * 360f; float offsetAngle = nextAngle - pieceAngle; for (int i = 0; i < _points.sertorCount; i++) { //立方体上表面多边形点 List <Vector3> tempUpPoints = new List <Vector3>(); //立方体下表面多边形点 List <Vector3> tempDownPoints = new List <Vector3>(); float tempAngle = pieceAngle + (float)(i) / (float)_points.sertorCount * (nextAngle - pieceAngle); float tempNextAngle = pieceAngle + (float)(i + 1) / (float)_points.sertorCount * (nextAngle - pieceAngle); if (i == 0) { tempUpPoints.Add(RotateAroundByPointByDistance(firstUpPoint, centerUp, Vector3.up, _points.size.x * _points.inCirclePercent, tempAngle, offsetAngle * _points.insertValue)); tempUpPoints.Add(RotateAroundByPointByDistance(firstUpPoint, centerUp, Vector3.up, _points.size.x, tempAngle, offsetAngle * _points.insertValue)); } else { tempUpPoints.Add(RotateAroundByPointByDistance(firstUpPoint, centerUp, Vector3.up, _points.size.x * _points.inCirclePercent, tempAngle)); tempUpPoints.Add(RotateAroundByPointByDistance(firstUpPoint, centerUp, Vector3.up, _points.size.x, tempAngle)); } if (i == _points.sertorCount - 1) { tempUpPoints.Add(RotateAroundByPointByDistance(firstUpPoint, centerUp, Vector3.up, _points.size.x, tempNextAngle, -offsetAngle * _points.insertValue)); tempUpPoints.Add(RotateAroundByPointByDistance(firstUpPoint, centerUp, Vector3.up, _points.size.x * _points.inCirclePercent, tempNextAngle, -offsetAngle * _points.insertValue)); } else { tempUpPoints.Add(RotateAroundByPointByDistance(firstUpPoint, centerUp, Vector3.up, _points.size.x, tempNextAngle)); tempUpPoints.Add(RotateAroundByPointByDistance(firstUpPoint, centerUp, Vector3.up, _points.size.x * _points.inCirclePercent, tempNextAngle)); } for (int j = 0; j < tempUpPoints.Count; j++) { tempDownPoints.Add(tempUpPoints[j] - new Vector3(0, _points.size.y, 0)); } tempPoints.AddRange(GetAllTrianglesPoint(tempUpPoints, tempDownPoints)); } return(tempPoints.ToArray()); }
//Vector3[] ResetNormals(Vector3[] vertices, Vector3[] normals) //{ // for (int i = 0; i < vertices.Length; i++) // { // List<int> indexes = new List<int>(); // for (int j = 0; j < vertices.Length; j++) // { // if (vertices[i] == vertices[j] && i != j) // { // indexes.Add(i); // } // } // Vector3 tempMiddle = Vector3.zero; // for (int j = 0; j < indexes.Count; j++) // { // tempMiddle += normals[indexes[j]]; // } // for (int j = 0; j < indexes.Count; j++) // { // normals[indexes[j]] = tempMiddle; // } // } // return normals; //} /// <summary> /// 根据顶点和位移差获取最终位置 /// </summary> /// <param name="vertices"></param> /// <param name="index"></param> /// <returns></returns> public virtual Vector3[] SetVerticesOffset(Vector3[] vertices, PointsInfo _points) { return(vertices); }