protected override WFData GenerateWFDataUnit(FrameRule clamp) { var num = clamp.num1; var unitSize = clamp.size1 / num; return(CalcuteUtility.TrigonumSpaceGrid_Unit(unitSize, clamp.height)); }
public override List <WFFul> CalcFulcrumPos(FrameRule clamp) { float x_Size = clamp.size1 / clamp.num1; float y_Size = clamp.size2 / clamp.num2; var startPos = -new Vector3(clamp.size1, -clamp.height, clamp.size2 - y_Size) * 0.5f; List <WFFul> positions = new List <WFFul>(); for (int i = 0; i < clamp.num1; i++) { for (int j = 0; j < clamp.num2; j++) { switch (clamp.fulcrumType) { case FulcrumType.downBound: CalcuteUtility.RecordQuadXieBound(i, j, clamp.num1, clamp.num2, startPos, x_Size, y_Size, positions, FulcrumType.downBound, clamp.height); break; default: break; } } } if (clamp.fulcrumType == FulcrumType.downBound && clamp.doubleLayer) { foreach (var item in positions) { item.AppendPosition(clamp.height * Vector3.down); } } return(positions); }
protected override WFData GenerateWFData(FrameRule clamp) { var startPos = -new Vector3(clamp.size1, -clamp.height, clamp.size2) * 0.5f; WFData wfData = new WFData(); float x_Size = clamp.size1 / clamp.num1; float y_Size = clamp.size2 / clamp.num2; var topNodes = new List <WFNode>(); for (int i = 0; i < clamp.num1; i++) { for (int j = 0; j < clamp.num2; j++) { if (i > 0 && i < clamp.num1 - 1 && j > 0 && j < clamp.num2 - 1 && (i + j) % 2 == 0) { continue; } WFData data = CalcuteUtility.QuadrangularSpaceGrid_Unit(x_Size, y_Size, clamp.height); data.AppendPosition(startPos + i * x_Size * Vector3.right + j * y_Size * Vector3.forward); topNodes.Add(data.wfNodes.Find(x => x.type == NodePosType.taperedTop)); //Debug.Log(data.wfNodes.Find(x => x.type == NodePosType.taperedTop).m_id); wfData.InsertData(data); } } var downData = CalcuteUtility.ConnectNeerBy(topNodes, Mathf.Sqrt(Mathf.Pow(x_Size, 2) + Mathf.Pow(y_Size, 2)), BarPosType.downBar, BoundConnectType.NoRule); wfData.InsertData(downData); return(wfData); }
protected override WFData GenerateWFDataUnit(FrameRule clamp) { float x_Size = clamp.size1 / clamp.num1; float y_Size = clamp.size2 / clamp.num2; return(CalcuteUtility.QuadrangularSpaceGrid_Unit(x_Size, y_Size, clamp.height)); }
protected override WFData GenerateWFData(FrameRule clamp) { var startPos = -new Vector3(clamp.size1, -clamp.height, clamp.size2) * 0.5f; WFData wfData = new WFData(); float x_Size = clamp.size1 / clamp.num1; float y_Size = clamp.size2 / clamp.num2; WFNode[,] topNodes = new WFNode[clamp.num1, clamp.num2]; for (int i = 0; i < clamp.num1; i++) { for (int j = 0; j < clamp.num2; j++) { if (i > 0 && i < clamp.num1 - 1 && j > 0 && j < clamp.num2 - 1 && i % 2 != 0 && j % 2 != 0) { continue; } WFData data = CalcuteUtility.QuadrangularSpaceGrid_Unit(x_Size, y_Size, clamp.height); data.AppendPosition(startPos + i * x_Size * Vector3.right + j * y_Size * Vector3.forward); topNodes[i, j] = data.wfNodes.Find(x => x.type == NodePosType.taperedTop); wfData.InsertData(data); } } var downData = CalcuteUtility.ConnectNeerBy(topNodes, BarPosType.downBar); wfData.InsertData(downData); return(wfData); }
protected override WFData GenerateWFDataUnit(FrameRule clamp) { float x_Size = clamp.size1 / clamp.num1; float y_Size = clamp.size2 / clamp.num2; WFData data = CalcuteUtility.TrussTypeDiamondSpaceGrid_Unit(x_Size, y_Size, clamp.height); return(data); }
public override List <WFFul> CalcFulcrumPos(FrameRule clamp) { var startPos = -new Vector3(clamp.size1, -clamp.height, clamp.size2) * 0.5f; float x_Size = clamp.size1 / clamp.num1; float y_Size = clamp.size2 / clamp.num2; List <WFFul> positions = new List <WFFul>(); for (int i = 0; i < clamp.num1; i++) { for (int j = 0; j < clamp.num2; j++) { switch (clamp.fulcrumType) { case FulcrumType.upBound: CalcuteUtility.RecordQuadBound(i, j, clamp.num1, clamp.num2, startPos, x_Size, y_Size, positions, clamp.fulcrumType); break; case FulcrumType.downBound: if (!clamp.doubleLayer) { CalcuteUtility.RecordQuadrAngular(i, j, clamp.num1, clamp.num2, startPos, x_Size, y_Size, clamp.height, positions, clamp.fulcrumType); } else { CalcuteUtility.RecordQuadBound(i, j, clamp.num1, clamp.num2, startPos, x_Size, y_Size, positions, clamp.fulcrumType, clamp.height); } break; case FulcrumType.upPoint: CalcuteUtility.RecordQuadPoint(i, j, clamp.num1, clamp.num2, startPos, x_Size, y_Size, positions, clamp.fulcrumType); break; case FulcrumType.downPoint: if (!clamp.doubleLayer) { CalcuteUtility.RecordQuadAngularPoint(i, j, clamp.num1, clamp.num2, startPos, x_Size, y_Size, clamp.height, positions, clamp.fulcrumType); } else { CalcuteUtility.RecordQuadPoint(i, j, clamp.num1, clamp.num2, startPos, x_Size, y_Size, positions, clamp.fulcrumType, clamp.height); } break; default: break; } } } if ((clamp.fulcrumType == FulcrumType.downBound || clamp.fulcrumType == FulcrumType.downPoint) && clamp.doubleLayer) { foreach (var item in positions) { item.AppendPosition(Vector3.down * clamp.height); } } return(positions); }
protected override WFData GenerateWFData(FrameRule clamp) { float x_Size = clamp.size1 / clamp.num1; float y_Size = clamp.size2 / clamp.num2; var startPos = -new Vector3(clamp.size1, -clamp.height, clamp.size2 - y_Size) * 0.5f; WFData wfData = new WFData(); WFNode[,] topNodes = new WFNode[clamp.num1, clamp.num2]; List <WFNode> bundNodes = new List <WFNode>(); for (int i = 0; i < clamp.num1; i++) { for (int j = 0; j < clamp.num2; j++) { WFData data = CalcuteUtility.QuadDiamondSpaceGrid_Unit(x_Size, y_Size, clamp.height); var position = startPos + i * x_Size * Vector3.right + j * y_Size * Vector3.forward; data.AppendPosition(position); topNodes[i, j] = data.wfNodes.Find(x => x.type == NodePosType.taperedTop); wfData.InsertData(data); if (i == 0)//左 { var node = data.wfNodes.Find(x => Vector3.Distance(x.position, position) < 0.1f); bundNodes.Add(node); } if (j == 0) {//下 var downPos = position + x_Size * Vector3.right * 0.5f - y_Size * Vector3.forward * 0.5f; var node = data.wfNodes.Find(x => Vector3.Distance(x.position, downPos) < 0.1f); bundNodes.Add(node); } if (i == clamp.num1 - 1)//右 { var rightPos = position + x_Size * Vector3.right; var node = data.wfNodes.Find(x => Vector3.Distance(x.position, rightPos) < 0.1f); bundNodes.Add(node); } if (j == clamp.num2 - 1)//上 { var upPos = position + x_Size * Vector3.right * 0.5f + y_Size * Vector3.forward * 0.5f; var node = data.wfNodes.Find(x => Vector3.Distance(x.position, upPos) < 0.1f); bundNodes.Add(node); } } } var downData = CalcuteUtility.ConnectNeerBy(topNodes, BarPosType.downBar); wfData.InsertData(downData); var bundData = CalcuteUtility.ConnectNeerBy(bundNodes, Mathf.Sqrt(Mathf.Pow(x_Size, 2) + Mathf.Pow(y_Size, 2)), BarPosType.upBar); wfData.InsertData(bundData); return(wfData); }
protected override WFData GenerateWFData(FrameRule clamp) { float x_Size = clamp.size1 / clamp.num1; float y_Size = clamp.size2 / clamp.num2; var startPos = -new Vector3(clamp.size1, clamp.height, clamp.size2 - y_Size) * 0.5f; WFData wfData = new WFData(); var bundNodes = new List <WFNode>(); for (int i = 0; i < clamp.num1; i++) { for (int j = 0; j < clamp.num2; j++) { WFData data = CalcuteUtility.TrussTypeDiamondSpaceGrid_Unit(x_Size, y_Size, clamp.height); var position = startPos + i * x_Size * Vector3.right + j * y_Size * Vector3.forward; data.AppendPosition(position); wfData.InsertData(data); if (i == 0)//左 { var nodes = data.wfNodes.FindAll(x => IsPointSmilarity(x.position, position)); bundNodes.AddRange(nodes); } if (j == 0) {//下 var downPos = position + x_Size * Vector3.right * 0.5f - y_Size * Vector3.forward * 0.5f; var nodes = data.wfNodes.FindAll(x => IsPointSmilarity(x.position, downPos)); bundNodes.AddRange(nodes); } if (i == clamp.num1 - 1)//右 { var rightPos = position + x_Size * Vector3.right; var nodes = data.wfNodes.FindAll(x => IsPointSmilarity(x.position, rightPos)); bundNodes.AddRange(nodes); } if (j == clamp.num2 - 1)//上 { var upPos = position + x_Size * Vector3.right * 0.5f + y_Size * Vector3.forward * 0.5f; var nodes = data.wfNodes.FindAll(x => IsPointSmilarity(x.position, upPos)); bundNodes.AddRange(nodes); } } } var bundData = CalcuteUtility.ConnectNeerBy(bundNodes, Mathf.Sqrt(Mathf.Pow(x_Size, 2) + Mathf.Pow(y_Size, 2)), BarPosType.upBar); wfData.InsertData(bundData); return(wfData); }
public override List <WFFul> CalcFulcrumPos(FrameRule clamp) { float x_Size = clamp.size1 / clamp.num1; float y_Size = clamp.size2 / clamp.num2; var startPos = -new Vector3(clamp.size1, -clamp.height, clamp.size2 - y_Size) * 0.5f; List <WFFul> positions = new List <WFFul>(); for (int i = 0; i < clamp.num1; i++) { for (int j = 0; j < clamp.num2; j++) { switch (clamp.fulcrumType) { case FulcrumType.upBound: CalcuteUtility.RecordQuadXieBound(i, j, clamp.num1, clamp.num2, startPos, x_Size, y_Size, positions, FulcrumType.upBound); break; case FulcrumType.downBound: if (!clamp.doubleLayer) { CalcuteUtility.RecordQuadrXieAngular(i, j, clamp.num1, clamp.num2, startPos, x_Size, y_Size, clamp.height, positions, FulcrumType.downBound); } else { CalcuteUtility.RecordQuadXieBound(i, j, clamp.num1, clamp.num2, startPos, x_Size, y_Size, positions, FulcrumType.downBound); } break; case FulcrumType.upPoint: break; case FulcrumType.downPoint: break; default: break; } } } if (clamp.doubleLayer && clamp.fulcrumType == FulcrumType.downBound) { for (int i = 0; i < positions.Count; i++) { positions[i].DoubleLayerPos(clamp.height); } } return(positions); }
protected override WFData GenerateWFData(FrameRule clamp) { var startPos = -new Vector3(clamp.size1, clamp.height, clamp.size2) * 0.5f; WFData wfData = new WFData(); float x_Size = clamp.size1 / clamp.num1; float y_Size = clamp.size2 / clamp.num2; for (int i = 0; i < clamp.num1; i++) { for (int j = 0; j < clamp.num2; j++) { WFData data = CalcuteUtility.TrussTypeThreeDirectionSpaceGrid_Unit(x_Size, y_Size, clamp.height); data.AppendPosition(startPos + i * x_Size * Vector3.right + j * y_Size * Vector3.forward); wfData.InsertData(data); } } return(wfData); }
private void RecordBoundNode(int i, int j, int num, WFData tdata, Vector3 pos, float unitSize, float unitHeight, List <WFNode> boundNodes) { if (i == -num) { var downNode = tdata.wfNodes.Find(x => CalcuteUtility.IsSimulatePos(x.position, pos)); boundNodes.Add(downNode); } if (j == 0 && i >= -1) { var leftPos = pos - unitSize * 0.5f * Vector3.right + unitHeight * Vector3.forward; var leftNode = tdata.wfNodes.Find(x => CalcuteUtility.IsSimulatePos(x.position, leftPos)); boundNodes.Add(leftNode); } if (j == 2 * num - Mathf.Abs(i + 1) - 1 && i >= -1) { var rightPos = pos + unitSize * 0.5f * Vector3.right + unitHeight * Vector3.forward; var rightNode = tdata.wfNodes.Find(x => CalcuteUtility.IsSimulatePos(x.position, rightPos)); boundNodes.Add(rightNode); } }
protected override WFData GenerateWFData(FrameRule clamp) { var data = new WFData(); var num = clamp.num1; var size = clamp.size1; var unitSize = clamp.size1 / num; var unitHeight = Mathf.Sin(Mathf.Deg2Rad * 60) * unitSize; var startPos = new Vector3(-size * 0.5f, clamp.height * 0.5f, -Mathf.Sin(Mathf.Deg2Rad * 60) * size); var boundNodes = new List <WFNode>(); var topNodes = new List <WFNode>(); for (int i = -num; i < num; i++) { for (int j = 0; j < 2 * num - Mathf.Abs(i + 1); j++) { var pos = startPos + (j * unitSize - 0.5f * unitSize * (num - Mathf.Abs(i + 1))) * Vector3.right + unitHeight * (i + num) * Vector3.forward; var tdata = CalcuteUtility.TrigonumSpaceGrid_Unit(unitSize, clamp.height); tdata.AppendPosition(pos); data.InsertData(tdata); //记录顶点用于连线 topNodes.Add(tdata.wfNodes.Find(x => x.type == NodePosType.taperedTop)); //记录边界节点用于连线 RecordBoundNode(i, j, num, tdata, pos, unitSize, unitHeight, boundNodes); } } var topData = CalcuteUtility.ConnectNeerBy(topNodes, unitSize, BarPosType.downBar, BoundConnectType.NoRule); data.InsertData(topData); var bundData = CalcuteUtility.ConnectNeerBy(boundNodes, unitSize, BarPosType.upBar, BoundConnectType.NoRule); data.InsertData(bundData); return(data); }
public override List <WFFul> CalcFulcrumPos(FrameRule clamp) { ///以下这个方法只实现了一种 //clamp.fulcrumType //也只实现了一层 var positions = new List <WFFul>(); var num = clamp.num1; var size = clamp.size1; var unitSize = clamp.size1 / num; var unitHeight = Mathf.Sin(Mathf.Deg2Rad * 60) * unitSize; var startPos = new Vector3(-size * 0.5f, clamp.height * 0.5f, -Mathf.Sin(Mathf.Deg2Rad * 60) * size); for (int i = -num; i < num; i++) { for (int j = 0; j < 2 * num - Mathf.Abs(i + 1); j++) { switch (clamp.fulcrumType) { case FulcrumType.upBound: CalcuteUtility.RecordSixBound(i, j, num, startPos, unitSize, unitHeight, positions, clamp.fulcrumType); break; case FulcrumType.downBound: CalcuteUtility.RecordSixBoundAngular(i, j, num, startPos, unitSize, unitHeight, clamp.height, positions, clamp.fulcrumType); break; default: break; } } } return(positions); }