Create an ellipse / circle in unity + C # - using Point3D and VirtualDraw

2

I need to implement in an Unity project the creation of an ellipse. In the project there is already the "line" and "rectangle" creation code that works perfectly. The project is for a masters and teacher has already made available a "skeleton" of the code. Being thus the part of the code of the circle, is with the code that creates the line.

Code that creates the rectangle:

private void draw(double x, double y, double z) //criar retangulo
{
  string text;

  if (m_pts.Count != 1)
    return;

  if (m_pDrawObj == null)
    return;

  // obtain initial and final point in local coordenate system
  Point3D p00 = m_plane.uvPoint(m_pts[0]);
  Point3D p11 = m_plane.uvPoint(new Point3D(x,y,z));

  // obtain other corner points
  Point3D p01 = m_plane.eval(p00.getX(), p11.getY());
  Point3D p10 = m_plane.eval(p11.getX(), p00.getY());

  m_pDrawObj.Line(m_pts[0].getX(), m_pts[0].getY(), m_pts[0].getZ(), p01.getX(), p01.getY(), p01.getZ());
  m_pDrawObj.Line(p01.getX(), p01.getY(), p01.getZ(), x, y, z);
  m_pDrawObj.Line(m_pts[0].getX(), m_pts[0].getY(), m_pts[0].getZ(), p10.getX(), p10.getY(), p10.getZ());
  m_pDrawObj.Line(p10.getX(), p10.getY(), p10.getZ(), x, y, z);

  // draw text update length
  Point3D pt = new Point3D(x, y, z);
  text = "Rectangle = " + m_pts[0].distance(pt).ToString();

  Point3D c = (m_pts[0] + pt) / 2.0;
  m_pDrawObj.text(c.getX(), c.getY(), c.getZ(), text);

}

Circle code:

private void draw(double x, double y, double z) //criar circulo
    {
        string text;

        if (m_pts.Count != 1)
            return;

        if (m_pDrawObj == null)
            return;

        m_pDrawObj.Line(m_pts[0].getX(), m_pts[0].getY(), m_pts[0].getZ(), x, y, z);

        // draw text update length
        Point3D pt = new Point3D(x, y, z);

        text = "Line = " + m_pts[0].distance(pt).ToString();

        Point3D c = (m_pts[0] + pt) / 2.0;

        m_pDrawObj.text(c.getX(), c.getY(), c.getZ(), text);

    }

If possible I would like you to indicate how I can create a circle in this project, already using this point3D class and VirtualDraw.Line. I have done several searches but I could not find anything like the code that already exists

Here you can see the project running, basically click on the circle figure at the top and click and drag on the plane and mount the circle

Any help is welcome! Thank you.

    
asked by anonymous 06.07.2017 / 16:34

0 answers