Пример #1
0
        private static bool TryGetPlaneVectors(WKSPointZ normal, WKSPointZ vector,
                                               out WKSPointZ planeVector1,
                                               out WKSPointZ planeVector2)
        {
            planeVector1 = WKSPointZUtils.GetVectorProduct(normal, vector);

            const double e = 0.1;

            if (GetLength2(planeVector1) < e)
            {
                planeVector2 = new WKSPointZ();
                return(false);
            }

            planeVector1 = WKSPointZUtils.GetNormed(planeVector1);

            planeVector2 = WKSPointZUtils.GetVectorProduct(normal, planeVector1);

            return(GetLength2(planeVector2) >= e);
        }
Пример #2
0
        public WKSPointZ GetPlaneVector()
        {
            WKSPointZ normal = GetNormalVector();

            WKSPointZ planeVector;

            if (TryGetNormal(normal, WKSPointZUtils.CreatePoint(1, 0, 0), out planeVector))
            {
            }
            else if (TryGetNormal(normal, WKSPointZUtils.CreatePoint(0, 1, 0), out planeVector))
            {
            }
            else if (TryGetNormal(normal, WKSPointZUtils.CreatePoint(0, 0, 1), out planeVector))
            {
            }
            else
            {
                throw new InvalidOperationException("unable to create plane vector");
            }

            WKSPointZ normedPlaneVector = WKSPointZUtils.GetNormed(planeVector);

            return(normedPlaneVector);
        }