Exemple #1
0
		public static CsgObject CreateBevel(CsgObject objectToApplyBevelTo, Edge edgeToRound, int radius)
		{
			Round bevel = new Round(objectToApplyBevelTo.Size);
			bevel.RoundEdge(edgeToRound, radius);
			return bevel;
		}
Exemple #2
0
		public static CsgObject CreateFillet(CsgObject objectA, Face faceA, CsgObject objectB, Face faceB, double radius, double extraDimension = defaultExtraDimension)
		{
			int centralAxis = 0; // we start defaulted to x
			switch ((Edge)(faceA | faceB))
			{
				case Edge.LeftTop:
				case Edge.LeftBottom:
				case Edge.RightTop:
				case Edge.RightBottom:
					centralAxis = 1; // y axis
					break;

				case Edge.LeftFront:
				case Edge.LeftBack:
				case Edge.RightFront:
				case Edge.RightBack:
					centralAxis = 2; // z axis
					break;
			}

			AxisAlignedBoundingBox boundsA = objectA.GetAxisAlignedBoundingBox();
			AxisAlignedBoundingBox boundsB = objectB.GetAxisAlignedBoundingBox();

			double maxMin = Math.Max(boundsA.minXYZ[centralAxis], boundsB.minXYZ[centralAxis]);
			double minMax = Math.Min(boundsA.maxXYZ[centralAxis], boundsB.maxXYZ[centralAxis]);
			if (maxMin >= minMax)
			{
				throw new ArgumentException("Your two objects must overlap to have a fillet be created.");
			}

			Vector3 size = new Vector3(radius, radius, radius);
			size[centralAxis] = minMax - maxMin;
			Round newFilletRound = new Round(size);

			Face faceToGetBevelFor = CsgObject.GetOposite(faceA) | CsgObject.GetOposite(faceB);
			newFilletRound.RoundEdge((Edge)faceToGetBevelFor, radius, extraDimension);

			CsgObject newFillet = new SetCenter(newFilletRound, objectA.GetCenter());
			newFillet = new Align(newFillet, CsgObject.GetOposite(faceA), objectA, faceA);
			newFillet = new Align(newFillet, CsgObject.GetOposite(faceB), objectB, faceB);

			return newFillet;
		}
Exemple #3
0
		public void BevelEdge(Edge edgeToBevel, double radius)
		{
			Round roundToApply = new Round(Size);
			roundToApply.RoundEdge(edgeToBevel, radius);
			CsgObject offsetRoundToApply = new Align(roundToApply, Face.Left | Face.Front | Face.Bottom, root, Face.Left | Face.Front | Face.Bottom);
			root -= offsetRoundToApply;
		}
Exemple #4
0
		public void BevelAll(double radius)
		{
			Round roundToApply = new Round(Size);
			roundToApply.RoundAll(radius);
			CsgObject offsetRoundToApply = new Align(roundToApply, Face.Left | Face.Front | Face.Bottom, root, Face.Left | Face.Front | Face.Bottom);
			root -= offsetRoundToApply;
		}
Exemple #5
0
		/// <summary>
		/// Bevel a give edge.  The edge is chosen by saying which 2 faces are to be used,
		/// and or-ing them together
		/// </summary>
		/// <param name="facesThatShareEdge">The two faces or-ed together with |</param>
		/// <param name="radius">The radius of the bevel</param>
		public void BevelEdge(Face facesThatShareEdge, double radius)
		{
			Round roundToApply = new Round(Size);
			roundToApply.RoundEdge((Edge)facesThatShareEdge, radius);
			CsgObject offsetRoundToApply = new Align(roundToApply, Face.Left | Face.Front | Face.Bottom, root, Face.Left | Face.Front | Face.Bottom);
			root -= offsetRoundToApply;
		}