//--------------------------------------------------------------------------------------------------

        bool _FindBendAxis(MakeContext context)
        {
            // Find the longest edge to revolve around
            var foundEdges = EdgeAlgo.FindLongestEdge(context.TargetFace);

            if (!foundEdges.axis.HasValue || !foundEdges.opAxis.HasValue)
            {
                Messages.Error("No linear edge found to bend around.");
                return(false);
            }

            context.BendEdge     = _Reverse ? foundEdges.opEdge : foundEdges.edge;
            context.OppositeEdge = _Reverse ? foundEdges.edge : foundEdges.opEdge;
            context.BendAxis     = _Reverse ? foundEdges.opAxis.Value : foundEdges.axis.Value;

            // Direction of the inner: Get face plane, get cross vector of edge axis and plane normal
            if (!FaceAlgo.GetCenteredPlaneFromFace(context.TargetFace, out var facePlane))
            {
                Messages.Error("Face must be of planar type.");
                return(false);
            }

            context.TopDirection = context.BendAxis.Direction.Crossed(facePlane.Axis.Direction);

            // Move axis by radius to the center of the revolve
            var radius = Math.Max(0.001, _Radius);

            context.BendAxis.Translate(context.TopDirection.ToVec().Multiplied(radius));
            return(true);
        }
        public void FindLongestEdge()
        {
            var box    = Box.Create(10.0, 10.0, 1.0);
            var face   = box.GetBRep().Faces()[1];
            var edges  = face.Edges();
            var result = EdgeAlgo.FindLongestEdge(face);

            Assert.NotNull(result.edge);
            Assert.NotNull(result.axis);
            Assert.NotNull(result.opEdge);
            Assert.NotNull(result.opAxis);

            Assert.AreEqual(edges[1], result.edge);
            Assert.AreEqual(edges[3], result.opEdge);

            Assert.IsTrue(result.axis.Value.IsParallel(result.opAxis.Value, Double.Epsilon));
        }