Arrays of wire frame curves C#


(Karol Wierzbicki) #1

Hi,

I’m trying to get two arrays of wire frame curves for surfaces. First array would be set of curves in one direction, 2nd array would be set of curves in another direction. Do you have any ideas, how to make it possibly the best way? Unfortunately there is no direct way as far as I can see.


(Karol Wierzbicki) #2

OK, Never mind, I’ve got something like this:

                arraySecondDirection.Add(edgeCurves[0]);
        for (int i = 1; i <= edgeCurves.Length - 1; i++)
        {
            Point3d pt0;
            Point3d pt1;

            edgeCurves[0].ClosestPoints(edgeCurves[i], out pt0, out pt1);

            if (pt1 != null && pt0 == pt1)
            {
                arrayFirstDirection.Add(edgeCurves[i]);
            }
            else
            {
                arraySecondDirection.Add(edgeCurves[i]);
            }
        }

(Alain Cormier) #3

Hi,

Would this also do what you want?

  Curve[] firstDirCurves =
  {
    surface.IsoCurve(0, surface.Domain(1).T0),
    surface.IsoCurve(0, surface.Domain(1).T1)
  };
  Curve[] secondDirCurves =
  {
    surface.IsoCurve(1, surface.Domain(0).T0),
    surface.IsoCurve(1, surface.Domain(0).T1)
  };

(Karol Wierzbicki) #4

Maybe it’s close, but this is not what I’m looking for. Your code will return only two arrays containing two curves each (edge curves). While I don’t know how many curves in array could possibly be. I’m working with complex surfaces, and there can be nearly infinite number of curves in each direction. For this purpose my code is doing just what I want. I take first curve, put it to second array, and check which curves are intersecting this one. Those will be put to first array, remaining curves will be put to second array alongside first curve.


(Alain Cormier) #5

Ok got it. I see you’ve edited your code since I first looked at it.
Cheers


(Karol Wierzbicki) #6

I’ve added this line:
arraySecondDirection.Add(edgeCurves[0]);

and this

&& pt0 == pt1

It works nice for me. But thanks for help anyway, I appreciate.