Does function Solid.Intersection() change input parameters?

44 views Asked by At

I try to understand if it's necessary to clone solid objects, before calling Solid.Intersection(). Next test (prepared with help of ChatGPT) doesn't work. I test Eyeshot v8.0.265.0.

[Test]
public void TestIntersectionCloning()
{
    // Create two boxes with a small overlap
    var boxA = Solid.CreateBox(2, 2, 2);
    boxA.Translate(-1, -1, -1);
    var boxB = Solid.CreateBox(2, 2, 2);
    boxB.Translate(0, 0, 0);

    // Clone the boxes
    var clonedA = boxA.Clone() as Solid;
    var clonedB = boxB.Clone() as Solid;

    // Intersect the cloned boxes
    var resultA = Solid.Intersection(clonedA, clonedB);

    // Check that the original boxes are not modified
    Assert.That(boxA.Vertices, Is.Not.Null);
    Assert.That(boxB.Vertices, Is.Not.Null);

    // Intersect the original boxes
    var resultB = Solid.Intersection(boxA, boxB);

    // Check that the original boxes are modified
    Assert.That(boxA.Vertices, Is.Null);
    Assert.That(boxB.Vertices, Is.Null);

    // Compare the intersection results
    Assert.That(resultA, Is.EqualTo(resultB));
}
0

There are 0 answers