Example #1
0
        public static SceneObject BuildPlaneIntersectionCurveSO(SOFactory factory, FScene scene, TypedAttribSet attributes)
        {
            PlaneIntersectionCurveSO so = new PlaneIntersectionCurveSO();

            so.Create(scene.DefaultCurveSOMaterial);
            factory.RestorePolyCurveSOType(scene, attributes, so);
            return(so);
        }
Example #2
0
        public static bool EmitPlaneIntersectionCurveSO(SceneSerializer s, IOutputStream o, SceneObject gso)
        {
            PlaneIntersectionCurveSO so = gso as PlaneIntersectionCurveSO;

            if (so == null)
            {
                throw new Exception("EmitPlaneIntersectionCurveSO: input so is not an PlaneIntersectionCurveSO!");
            }
            o.AddAttribute(IOStrings.ASOType, so.Type.identifier);
            SceneSerializerEmitTypesExt.EmitPolyCurveSO(s, o, so as PolyCurveSO);
            return(true);
        }
Example #3
0
        public IVectorDisplacementSourceOp AppendLegSqueezeOp(Vector3f upperPointL, PlaneIntersectionCurveSO UpperCurveSO)
        {
            LegSqueezeOp deformOp = new LegSqueezeOp()
            {
                UpperPoint = upperPointL,
                Axis       = Vector3d.AxisY,
                MeshSource = SOMeshSource
            };

            Combiner.Append(deformOp);
            SO_Op.Add(UpperCurveSO, deformOp);

            OnDeformationAdded?.Invoke(UpperCurveSO, deformOp);

            return(deformOp);
        }
        public static PlaneIntersectionCurveSO CreateFromPlane(DMeshSO TargetSO, Frame3f PlaneS, SOMaterial material, FScene scene, double fNormalOffset = 0.0f)
        {
            Frame3f PlaneO = SceneTransforms.SceneToObject(TargetSO, PlaneS);

            PlaneIntersectionCurves curves = new PlaneIntersectionCurves(TargetSO.Mesh, PlaneO, 1)
            {
                NormalOffset = fNormalOffset
            };

            curves.Compute();

            if (curves.Loops.Length != 1)
            {
                throw new Exception("PlaneIntersectionSO.CreateFromPlane: got more than one cut loop?");
            }
            DCurve3 loop = curves.Loops[0];

            // map loop back into plane frame
            for (int i = 0; i < loop.VertexCount; ++i)
            {
                loop[i] = PlaneO.ToFrameP(loop[i]);
            }


            PlaneIntersectionCurveSO curveSO = new PlaneIntersectionCurveSO()
            {
                Curve = loop
            };

            curveSO.Create(material);
            Frame3f curveFrame = SceneTransforms.ObjectToScene(TargetSO, PlaneO);

            curveSO.SetLocalFrame(curveFrame, CoordSpace.ObjectCoords);

            scene.History.PushChange(
                new AddSOChange()
            {
                scene = scene, so = curveSO, bKeepWorldPosition = false
            });
            scene.History.PushInteractionCheckpoint();

            return(curveSO);
        }
Example #5
0
        public IVectorDisplacementSourceOp AppendPlaneBandExpansion(PlaneIntersectionCurveSO Source)
        {
            Frame3f deformF = Frame3f.Identity;

            deformF = SceneTransforms.TransformTo(deformF, Source, leg);

            PlaneBandExpansionOp deformOp = new PlaneBandExpansionOp()
            {
                Origin           = deformF.Origin,
                Normal           = deformF.Y,
                BandDistance     = 15.0f,
                PushPullDistance = -1.0f,
                MeshSource       = SOMeshSource
            };

            Combiner.Append(deformOp);
            SO_Op.Add(Source, deformOp);

            OnDeformationAdded?.Invoke(Source, deformOp);

            return(deformOp);
        }
        public override PolyCurveSO Create(SOMaterial defaultMaterial)
        {
            PlaneIntersectionCurveSO so = (PlaneIntersectionCurveSO)base.Create(defaultMaterial);

            return(so);
        }