public NewPrimitive SnappedToNew(SnappedPrimitive source)
 {
     Contract.Requires(source != null);
     Contract.Ensures(Contract.Result <NewPrimitive>() != null);
     return(null);
 }
 public Tuple <Term, Term[]> Reconstruct(SnappedPrimitive snappedPrimitive, Dictionary <FeatureCurve, ISet <Annotation> > curvesToAnnotations)
 {
     return(Reconstruct((TSnapped)snappedPrimitive, curvesToAnnotations));
 }
        private static Visual3D CreateCylinderView(Point3D[] topPoints, Point3D[] botPoints, SnappedPrimitive snappedPrimitive)
        {
            Contract.Requires(topPoints.Length == botPoints.Length);
            Contract.Requires(snappedPrimitive != null);

            var m = topPoints.Length;

            // top points indices [0 .. m-1]
            var topIdx = System.Linq.Enumerable.Range(0, m).ToArray();

            // bottom points indices [m .. 2*m - 1]
            var bottomIdx = System.Linq.Enumerable.Range(m, m).ToArray();

            Contract.Assume(topIdx.Length == bottomIdx.Length);

            // create cylinder geometry
            var geometry = new MeshGeometry3D();

            geometry.Positions       = new Point3DCollection(topPoints.Concat(botPoints));
            geometry.TriangleIndices = new Int32Collection();
            for (int i = 0; i < m; ++i)
            {
                var j  = (i + 1) % m;
                var pc = topIdx[i];
                var pn = topIdx[j];
                var qc = bottomIdx[i];
                var qn = bottomIdx[j];

                geometry.TriangleIndices.AddMany(pc, qc, pn);
                geometry.TriangleIndices.AddMany(qc, qn, pn);
            }

            return(CreateVisual(geometry, snappedPrimitive));
        }
 public IEnumerable <Annotation> InferAnnotations(NewPrimitive toBeSnapped, SnappedPrimitive toBeAnnotated)
 {
     return(inferenceEngine.InferAnnotations(toBeSnapped, toBeAnnotated));
 }
Esempio n. 5
0
 private static Type GetKey(SnappedPrimitive source)
 {
     return(source.GetType());
 }
Esempio n. 6
0
 public NewPrimitive SnappedToNew(SnappedPrimitive source)
 {
     return(snappedConvertersRegistry[GetKey(source)].Convert(source));
 }
        public NewPrimitive Convert(SnappedPrimitive snapped)
        {
            var concreteSnapped = (TSnapped)snapped;

            return(ConvertCore(concreteSnapped));
        }