// A -> LAL private bool ResolveBottomA(BottomConverter converter, out bool judge) { judge = false; if (bottomConditions.Count == 1 && bottomConditions[0] is BottomAngleCondition) { BottomAngleCondition condition = (BottomAngleCondition)bottomConditions[0]; float a, b, c, alpha; converter.aER = new EdgeRefer(condition.corner.id1, condition.corner.id2); converter.bER = new EdgeRefer(condition.corner.id3, condition.corner.id2); converter.cER = new EdgeRefer(condition.corner.id1, condition.corner.id3); a = EdgeIndexLength(condition.corner.id1, condition.corner.id2); b = EdgeIndexLength(condition.corner.id3, condition.corner.id2); c = EdgeReferLength(converter.cER); alpha = condition.angle; judge = BottomLAL(a, b, alpha, ref c); ConverterSetABC(converter, a, b, c); return(true); } return(false); }
public void AddBottomAngle() { BottomAngleCondition condition = new BottomAngleCondition(corner.x, corner.y, corner.z, angle); geometry.Constructor.AddCondition(condition); PrintAtttributes(); }
public BottomAngleConditionState(Tool tool, Condition condition, Geometry geometry) : base(tool, condition) { if (condition is BottomAngleCondition) { this.condition = (BottomAngleCondition)condition; } if (geometry is TriPyramid) { this.geometry = (TriPyramid)geometry; } }
// ALA private bool ResolveBottomALA(BottomConverter converter, out bool judge) { judge = false; if (bottomConditions.Count == 3 && bottomConditions[0] is BottomLengthCondition && bottomConditions[1] is BottomAngleCondition && bottomConditions[2] is BottomAngleCondition) { BottomLengthCondition condition1 = (BottomLengthCondition)bottomConditions[0]; BottomAngleCondition condition2 = (BottomAngleCondition)bottomConditions[1]; BottomAngleCondition condition3 = (BottomAngleCondition)bottomConditions[2]; if (IsEdgeOppositeCorner(condition1.edge, condition2.corner) || IsEdgeOppositeCorner(condition1.edge, condition3.corner)) { int index = EdgeOppositeIndex(new EdgeRefer(condition2.corner.id2, condition3.corner.id2)); float angle = 180 - condition2.angle - condition3.angle; BottomAngleCondition conditionN = new BottomAngleCondition(condition2.corner.id2, index, condition3.corner.id2, angle); if (IsEdgeOppositeCorner(condition1.edge, condition2.corner)) { condition2 = conditionN; } else if (IsEdgeOppositeCorner(condition1.edge, condition3.corner)) { condition3 = conditionN; } } float a, b, c, alpha, beta; int id3 = EdgeOppositeIndex(condition1.edge); converter.aER = new EdgeRefer(condition1.edge.id1, condition1.edge.id2); converter.bER = new EdgeRefer(condition2.corner.id2, id3); converter.cER = new EdgeRefer(condition3.corner.id2, id3); a = condition1.length; b = EdgeReferLength(converter.bER); c = EdgeReferLength(converter.cER); alpha = condition2.angle; beta = condition3.angle; judge = BottomALA(a, alpha, beta, ref b, ref c); ConverterSetABC(converter, a, b, c); return(true); } return(false); }
// LLA private bool ResolveBottomLLA(BottomConverter converter, out bool judge) { judge = false; if (bottomConditions.Count == 3 && bottomConditions[0] is BottomLengthCondition && bottomConditions[1] is BottomLengthCondition && bottomConditions[2] is BottomAngleCondition) { BottomLengthCondition condition1 = (BottomLengthCondition)bottomConditions[0]; BottomLengthCondition condition2 = (BottomLengthCondition)bottomConditions[1]; BottomAngleCondition condition3 = (BottomAngleCondition)bottomConditions[2]; bool isLLA = IsEdgeOppositeCorner(condition1.edge, condition3.corner) || IsEdgeOppositeCorner(condition2.edge, condition3.corner); if (!isLLA) { return(false); } if (IsEdgeOppositeCorner(condition1.edge, condition3.corner)) { SwapCondition <BottomLengthCondition>(ref condition1, ref condition2); } float a, b, c, alpha; int id3 = EdgeOppositeIndex(condition1.edge); converter.aER = new EdgeRefer(condition1.edge.id1, condition1.edge.id2); converter.bER = new EdgeRefer(condition2.edge.id1, condition2.edge.id2); converter.cER = new EdgeRefer(condition3.corner.id2, id3); a = condition1.length; b = condition2.length; c = EdgeReferLength(converter.cER); alpha = condition3.angle; judge = BottomLLA(a, b, alpha, ref c); ConverterSetABC(converter, a, b, c); return(true); } return(false); }
// AA -> ALA private bool ResolveBottomAA(BottomConverter converter, out bool judge) { judge = false; if (bottomConditions.Count == 2 && bottomConditions[0] is BottomAngleCondition && bottomConditions[1] is BottomAngleCondition) { BottomAngleCondition condition1 = (BottomAngleCondition)bottomConditions[0]; BottomAngleCondition condition2 = (BottomAngleCondition)bottomConditions[1]; if (condition1.corner.id1 == condition2.corner.id3) { condition2.corner.SwapIndex(); } if (condition1.corner.id3 == condition2.corner.id1) { condition1.corner.SwapIndex(); } if (condition1.corner.id3 == condition2.corner.id3) { condition1.corner.SwapIndex(); condition2.corner.SwapIndex(); } float a, b, c, alpha, beta; converter.aER = new EdgeRefer(condition1.corner.id2, condition2.corner.id2); converter.bER = new EdgeRefer(condition1.corner.id1, condition1.corner.id2); converter.cER = new EdgeRefer(condition2.corner.id1, condition2.corner.id2); a = EdgeIndexLength(condition1.corner.id2, condition2.corner.id2); b = EdgeReferLength(converter.bER); c = EdgeReferLength(converter.cER); alpha = condition1.angle; beta = condition2.angle; judge = BottomALA(a, alpha, beta, ref b, ref c); ConverterSetABC(converter, a, b, c); return(true); } return(false); }
public override Condition GenerateCondition(Geometry geometry, FormInput formInput) { bool valid = ValidateInput(geometry, formInput); if (!valid) { return(null); } FormElement formElement = (FormElement)formInput.inputs[1]; string[] fields = formElement.fields; int id1 = geometry.SignVertex(fields[0]); int id2 = geometry.SignVertex(fields[1]); int id3 = geometry.SignVertex(fields[2]); FormNum formNum = (FormNum)formInput.inputs[3]; BottomAngleCondition condition = new BottomAngleCondition(id1, id2, id3, formNum.num); return(condition); }
// AL -> LAL private bool ResolveBottomAL(BottomConverter converter, out bool judge) { judge = false; if (bottomConditions.Count == 2 && bottomConditions[0] is BottomLengthCondition && bottomConditions[1] is BottomAngleCondition) { BottomLengthCondition condition1 = (BottomLengthCondition)bottomConditions[0]; BottomAngleCondition condition2 = (BottomAngleCondition)bottomConditions[1]; bool isAL = IsEdgeAdjacentCorner(condition1.edge, condition2.corner); if (!isAL) { return(false); } float a, b, c, alpha; int id3 = EdgeOppositeIndex(condition1.edge); converter.aER = new EdgeRefer(condition1.edge.id1, condition1.edge.id2); converter.bER = new EdgeRefer(condition2.corner.id2, id3); converter.cER = new EdgeRefer(condition2.corner.id1, condition2.corner.id3); a = condition1.length; b = EdgeIndexLength(condition2.corner.id2, id3); c = EdgeReferLength(converter.cER); alpha = condition2.angle; judge = BottomLAL(a, b, alpha, ref c); ConverterSetABC(converter, a, b, c); return(true); } return(false); }
// LA -> LLA private bool ResolveBottomLA(BottomConverter converter, out bool judge) { judge = false; if (bottomConditions.Count == 2 && bottomConditions[0] is BottomLengthCondition && bottomConditions[1] is BottomAngleCondition) { BottomLengthCondition condition1 = (BottomLengthCondition)bottomConditions[0]; BottomAngleCondition condition2 = (BottomAngleCondition)bottomConditions[1]; bool isLA = IsEdgeOppositeCorner(condition1.edge, condition2.corner); if (!isLA) { return(false); } float a, b, c, alpha; converter.aER = new EdgeRefer(condition2.corner.id2, condition2.corner.id1); converter.bER = new EdgeRefer(condition2.corner.id1, condition2.corner.id3); converter.cER = new EdgeRefer(condition2.corner.id2, condition2.corner.id3); b = condition1.length; alpha = condition2.angle; a = Mathf.Min(b / Mathf.Sin(alpha * Mathf.Deg2Rad), EdgeIndexLength(condition2.corner.id2, condition2.corner.id1)); c = EdgeReferLength(converter.cER); judge = BottomLLA(a, b, alpha, ref c); ConverterSetABC(converter, a, b, c); return(true); } return(false); }