How to intersect 3D using multipatch

745
3
02-06-2012 05:40 AM
Highlighted
New Contributor
Hello,

I do not find any documentation about how to intersect two multipatch in 3D.
Here my code to create both multipatch :

// first multipatch
IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();
IPointCollection triangleFanPointCollection = new TriangleFanClass();
triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(596350, 4115350, 500), ref _missing, ref _missing);
triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(596500, 4115500, 200), ref _missing, ref _missing);
triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(596500, 4115200, 200), ref _missing, ref _missing);
triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(596200, 4115200, 200), ref _missing, ref _missing);
triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(596200, 4115500, 200), ref _missing, ref _missing);
triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(596500, 4115500, 200), ref _missing, ref _missing);
multiPatchGeometryCollection.AddGeometry(triangleFanPointCollection as IGeometry, ref _missing, ref _missing);

// second multipatch
IGeometryCollection multiPatchGeometryCollectionSmall = new MultiPatchClass();
IPointCollection triangleFanPointCollectionSmall = new TriangleFanClass();
triangleFanPointCollectionSmall.AddPoint(GeometryUtilities.ConstructPoint3D(596350, 4115350, 300), ref _missing, ref _missing);
triangleFanPointCollectionSmall.AddPoint(GeometryUtilities.ConstructPoint3D(596500, 4115500, 200), ref _missing, ref _missing);
triangleFanPointCollectionSmall.AddPoint(GeometryUtilities.ConstructPoint3D(596500, 4115200, 200), ref _missing, ref _missing);
triangleFanPointCollectionSmall.AddPoint(GeometryUtilities.ConstructPoint3D(596200, 4115200, 200), ref _missing, ref _missing);
triangleFanPointCollectionSmall.AddPoint(GeometryUtilities.ConstructPoint3D(596200, 4115500, 200), ref _missing, ref _missing);
triangleFanPointCollectionSmall.AddPoint(GeometryUtilities.ConstructPoint3D(596500, 4115500, 200), ref _missing, ref _missing);
multiPatchGeometryCollectionSmall.AddGeometry(triangleFanPointCollectionSmall as IGeometry, ref _missing, ref _missing);

// cast en multipatch
IMultiPatch multipatch = multiPatchGeometryCollection as IMultiPatch;
IMultiPatch multipatchSmall = multiPatchGeometryCollectionSmall as IMultiPatch;


GeometryUtilities.ConstructPoint3D return an IPoint (first and second parameters as X,Y and last parameters as Z)

but now how can I intersect those two multipatch by code using arcobject?
Reply
0 Kudos
3 Replies
Highlighted
Occasional Contributor II
From ArcObject level, what I can think of is using ITopologicalOperator::Intersect method.  However, the output geometry will not be in 3D, means the operation is performed on the footprint of the input multipatch.

There are some 3D Analyst Tools can do 3D intersection.  You do need special license for that.
Reply
0 Kudos
Highlighted
New Contributor
I suceed to create a cube (closed 3D) using multipatch :


IGeometryCollection multiPatchGeometryCollectionCube = new MultiPatchClass();
                IPointCollection triangleStripPointCollection = new TriangleStripClass();

                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5, 0.5, 0.5), ref _missing, ref _missing);
                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5, 0.5, 0.5), ref _missing, ref _missing);
                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5, -0.5, 0.5), ref _missing, ref _missing);

                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5, -0.5, 0.5), ref _missing, ref _missing);
                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5, -0.5, -0.5), ref _missing, ref _missing);
                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5, 0.5, 0.5), ref _missing, ref _missing);

                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5, 0.5, -0.5), ref _missing, ref _missing);
                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5, 0.5, 0.5), ref _missing, ref _missing);
                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5, 0.5, -0.5), ref _missing, ref _missing);

                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5, -0.5, 0.5), ref _missing, ref _missing);
                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5, -0.5, -0.5), ref _missing, ref _missing);
                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5, -0.5, -0.5), ref _missing, ref _missing);

                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5, 0.5, -0.5), ref _missing, ref _missing);
                triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5, 0.5, -0.5), ref _missing, ref _missing);

                multiPatchGeometryCollectionCube.AddGeometry(triangleStripPointCollection as IGeometry, ref _missing, ref _missing);


with the code above you can cast multiPatchGeometryCollectionCube to IGeometry.
Now I have to intersect two closed multipatches.
Reply
0 Kudos
Highlighted
New Contributor
I found the solution to calculate an intersect 3D between two multipatches :


Geoprocessor gp = new Geoprocessor();
                Intersect3D analys = new ESRI.ArcGIS.Analyst3DTools.Intersect3D();
                analys.in_feature_class_1 = @"D:\3_DATA\TEMP\TestOutPutMultiPatchCUBE.shp";
                analys.in_feature_class_2 = @"D:\3_DATA\TEMP\TestOutPutMultiPatchCUBE2.shp";
                analys.out_feature_class = @"D:\3_DATA\TEMP\outputTest.shp";
                gp.Execute(analys, null);


However I do not think it's possible to intersect two multipatches without saved them into shapefile (or database).

am I right ?
Reply
0 Kudos