Beispiel #1
0
        protected override bool AllVerticesInFrustum(FrustumParams data)
        {
            // Computes the triangles that are completely enclosed to the selection rectangle

            if (vp.processVisibleOnly && !Selected)
            {
                return(false);
            }

            SelectedSubItems = new List <int>();

            for (int i = 0; i < Triangles.Length; i++)
            {
                IndexTriangle tri = Triangles[i];

                if (Camera.IsInFrustum(Vertices[tri.V1], data.Frustum) && Camera.IsInFrustum(Vertices[tri.V2], data.Frustum) &&
                    Camera.IsInFrustum(Vertices[tri.V3], data.Frustum))
                {
                    SelectedSubItems.Add(i);
                }
            }

            UpdateCompileSelection();
            return(false);
        }
Beispiel #2
0
        public override bool IsInFrustum(FrustumParams data, Point3D center, double radius)
        {
            Point3D transfCenter = (Point3D)center.Clone();

            if (t != 0 && rotationAxis != null)
            {
                // Get the BlockReference full transformation
                Transformation brFullTransf = GetFullTransformation(data.Blocks);

                // Apply the inverse of the full transformation to the center to bring it back to original position
                // It's necessary because in the MoveTo() the first transformation is applied before tha base method is called.
                Transformation tr = (Transformation)brFullTransf.Clone();
                tr.Invert();
                transfCenter.TransformBy(tr);

                // Compute a transformation equals to the transformation applied in the MoveTo method
                Translation translation1 = new Translation(t * translationVect.X, t * translationVect.Y, t * translationVect.Z);
                Translation translation2 = new Translation(firstPt.X, firstPt.Y, firstPt.Z);
                Translation translation3 = new Translation(-firstPt.X, -firstPt.Y, -firstPt.Z);
                Rotation    rotation     = new Rotation(Utility.DegToRad(t * rotationAngle), rotationAxis);

                Transformation customTransform = translation1 * brFullTransf;
                customTransform = customTransform * translation2;
                customTransform = customTransform * rotation;
                customTransform = customTransform * translation3;

                // Apply transformation to the center
                transfCenter.TransformBy(customTransform);
            }

            // Call the base with the transformed "center", to avoid undesired clipping
            return(base.IsInFrustum(data, transfCenter, radius));
        }
Beispiel #3
0
        protected override bool ThroughTriangle(FrustumParams data)
        {
            SelectedSubItems.Sort();

            //if selection filter is ByPick/VisibleByPick selects only the first triangle
            if (vp.firstOnlyInternal && !vp.processVisibleOnly && SelectedSubItems.Count > 0)
            {
                return(false);
            }

            bool through = false;

            for (int i = 0; i < Triangles.Length; i++)
            {
                if (SelectedSubItems.BinarySearch(i) >= 0)
                {
                    continue;
                }

                if (ThroughTriangle(data, GetTriangleVertices(Triangles[i])))
                {
                    SelectedSubItems.Add(i);

                    through = true;

                    if (vp.firstOnlyInternal && !vp.processVisibleOnly)
                    {
                        return(true);
                    }
                }
            }

            return(through);
        }
Beispiel #4
0
        protected override bool InsideOrCrossingFrustum(FrustumParams data)
        {
            // Computes the triangles that are inside or crossing the selection planes

            bool insideOrCrossing = false;

            for (int i = 0; i < Triangles.Length; i++)
            {
                var verts = GetTriangleVertices(Triangles[i]);
                if (Utility.InsideOrCrossingFrustum(verts[0], verts[1], verts[2], data.Frustum))
                {
                    SelectedSubItems.Add(i);

                    insideOrCrossing = true;

                    //if selection filter is ByPick/VisibleByPick selects only the first triangle
                    if (vp.firstOnlyInternal && !vp.processVisibleOnly)
                    {
                        return(true);
                    }
                }
            }

            return(insideOrCrossing);
        }
Beispiel #5
0
            protected override bool AllVerticesInFrustum(FrustumParams data)
            {
                if (entityNature == entityNatureType.Wire)
                {
                    return(UtilityEx.AllVerticesInFrustum(data, wireVertices, wireVertices.Length));
                }

                return(base.AllVerticesInFrustum(data));
            }
Beispiel #6
0
 protected override bool ThroughTriangle(FrustumParams data)
 {
     if (entityNature == entityNatureType.Wire)
     {
         return(false);
     }
     //else
     return(base.ThroughTriangle(data));
 }
Beispiel #7
0
        protected override bool IsCrossing(FrustumParams data)
        {
            if (vp.processVisibleOnly && !Selected)
            {
                return(false);
            }

            SelectedSubItems = new List <int>();

            bool res = InsideOrCrossingFrustum(data);

            return(res);
        }
Beispiel #8
0
        protected override bool InsideOrCrossingFrustum(FrustumParams data)
        {
            if (entityNature == entityNatureType.Wire)
            {
                for (int i = 0; i < wireVertices.Length; i += 2)
                {
                    if (Utility.IsSegmentInsideOrCrossing(data.Frustum, new Segment3D(wireVertices[i], wireVertices[i + 1])))
                    {
                        return(true);
                    }
                }
                return(false);
            }

            return(base.InsideOrCrossingFrustum(data));
        }
Beispiel #9
0
        protected override bool IsCrossing(FrustumParams data)
        {
            if (vp.processVisibleOnly && !Selected)
            {
                return(false);
            }

            SelectedSubItems = new List <int>();

            bool res = InsideOrCrossingFrustum(data);

            if (data.DisplayMode != displayType.Wireframe && ThroughTriangle(data))
            {
                res = true;
            }

            UpdateCompileSelection();

            return(res);
        }
Beispiel #10
0
        bool ThroughTriangle(FrustumParams data, Point3D[] vertices)
        {
            Transformation transform = data.Transformation;

            if (transform == null)
            {
                if (FrustumEdgesTriangleIntersection(data.SelectionEdges, vertices[0], vertices[1], vertices[2]))
                {
                    return(true);
                }
            }
            else
            {
                if (FrustumEdgesTriangleIntersection(data.SelectionEdges, transform * vertices[0], transform * vertices[1], transform * vertices[2]))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #11
0
            protected override bool InsideOrCrossingFrustum(FrustumParams data)
            {
                if (entityNature == entityNatureType.Wire)
                {
                    var transform = data.Transformation;
                    if (transform == null)
                    {
                        transform = new Identity();
                    }

                    for (int i = 0; i < wireVertices.Length; i += 2)
                    {
                        if (Utility.IsSegmentInsideOrCrossing(data.Frustum, new Segment3D(transform * wireVertices[i], transform * wireVertices[i + 1])))
                        {
                            return(true);
                        }
                    }

                    return(false);
                }

                return(base.InsideOrCrossingFrustum(data));
            }
Beispiel #12
0
        protected override bool InsideOrCrossingFrustum(FrustumParams data)
        {
            // Computes the lines that are inside or crossing the selection planes

            bool insideOrCrossing = false;

            for (int i = 0; i < Lines.Length; i++)
            {
                if (Utility.IsSegmentInsideOrCrossing(data.Frustum, new Segment3D(Vertices[Lines[i].V1], Vertices[Lines[i].V2])))
                {
                    SelectedSubItems.Add(i);

                    insideOrCrossing = true;

                    //if selection filter is ByPick/VisibleByPick selects only the first line
                    if (vp.firstOnlyInternal && !vp.processVisibleOnly)
                    {
                        return(true);
                    }
                }
            }

            return(insideOrCrossing);
        }
Beispiel #13
0
 // makes rocket always visible. Actual rocket position may go out of frustum.
 public override bool IsInFrustum(FrustumParams data, Point3D center, double radius)
 {
     return(true);
 }
Beispiel #14
0
 public override bool IsInFrustum(FrustumParams data, Point3D center, double radius)
 {
     // Call the base with the transformed "center", to avoid undesired clipping
     return(base.IsInFrustum(data, customTransform * center, radius));
 }
Beispiel #15
0
 public override bool IsInFrustum(FrustumParams data, Point3D center, double radius)
 {
     // return true to avoid undesired clipping
     return(true);
 }