DG Kernel Documentation


Skip Navigation Links.
Skip Navigation LinksHome Page > API Reference > Model > Entities > Geometry > ISurfacePoint_DG Search Documentation


ISurfacePoint_DG Interface

GetLocation
GetEntity
GetElement
GetElementDimension
GetElementType
GetElementType1
GetParentElement
GetParentElementCount
GetNormalCount
GetNormal
GetParameter

Represents a point on surface of an entity

In this update ISurfacePoint_DG can be obtained via IPick_DG.GetSurfacePointAt() call


Point_DG GetLocation()

Returns 3D coordinates of the point


IEntity_DG GetEntity()

Returns the entity, on surface of which this point is geometrically located or null if the point is outside of any surface


Object GetElement()

Let int dim = GetElementDimension()

If GetEntity().GetGeometryType() returns "BRep", the actual type of the interface returned by this method is:
IBRepVertex_DG if dim = 0
IBRepEdge_DG if dim = 1
IBRepFace_DG if dim = 2

If GetEntity().GetGeometryType() returns "Mesh", the actual type of the interface returned by this method is:
IVertex if dim = 0
IEdge_KC if dim = 1
ISimplex if dim = 2

Example:

ISurfacePoint_DG iSurfPoint = m_iPick.GetSurfacePointAt(x, y);
IEntity_DG iEntity = iSurfPoint.GetEntity();
string strGeometryType = iEntity.GetGeometryType();
int dim = iSurfPoint.GetElementDimension();

if (strGeometryType == "BRep")
{
    if (dim == 0)
    {
        IBRepVertex_DG iVertex = iSurfPoint.GetElement() as IBRepVertex_DG;
        PointDg pt = iVertex.GetPosition1();
    }
    else if (dim == 1)
    {
        IBRepEdge_DG iEdge = iSurfPoint.GetElement() as IBRepEdge_DG;
        PointDg pt = iEdge.GetPointRatio(0.5);
    }
    else if (dim == 2)
    {
        IBRepFace_DG iFace = iSurfPoint.GetElement() as IBRepFace_DG;
        PointDg pt = iFace.GetPointAtRatios(new Dg_2D(0.5, 0.5));
     }
}
else if (strGeometryType == "Mesh")
{
    double xx, yy, zz;
    if (dim == 0)
    {
        IVertex iVertex = iSurfPoint.GetElement() as IVertex;
        iVertex.GetVertexCoord(out xx, out yy, out zz);
    }
    else if (dim == 1)
    {
        IEdge_KC iEdge = iSurfPoint.GetElement() as IEdge_KC;
        IVertex iVertex = iEdge.GetEnd(0);
        iVertex.GetVertexCoord(out xx, out yy, out zz);
    }
    else if (dim == 2)
    {
        ISimplex iSimplex = iSurfPoint.GetElement() as ISimplex;
        POSNT pos = iSimplex.GetVertexPosition(0);
        IMeshT iMesh = (IMeshT)iEntity;
        iMesh.GetVertexCoord(pos, out xx, out yy, out zz);
    }
}


int GetElementDimension()

Returns the lowest dimension of the surface element where this point belongs to (incident).
It is 0 for BRep or mesh vertex, 1 for BRep or Mesh edge and 2 for BRep face or mesh simplex.


string GetElementType()

This method is a shortcut for GetElementType1(GetElementDimension())


string GetElementType1(int dim)

Returns name of the interface returned by the GetElement():

If GetEntity().GetGeometryType() returns "BRep", this method returns:
"IBRepVertex_DG" if dim = 0
"IBRepEdge_DG" if dim = 1
"IBRepFace_DG" if dim = 2

If GetEntity().GetGeometryType() returns "Mesh", this method returns:
"IVertex" if dim = 0
"IEdge_KC" if dim = 1
"ISimplex" if dim = 2


Object GetParentElement(int dim)

Not implemented in this release


int GetParentElementCount(int dim)

Not implemented in this release


int GetNormalCount()

Returns 1 for faces or simplexes, 2 for edges or segments, 0 for vertices


Vect_DG GetNormal(int i)

Not implemented in this release


int GetParameter(out DG2D uv)

Returns the parameter in uv. Returns GetElementDimension(). The return 1 means only the first component of uv (uv.x[0]) is valid.