# OESurface¶

```
class OESurface : public OESystem::OEBase
```

## Constructors¶

```
OESurface()
OESurface(const OESurface &rhs)
OESurface(const OESurfaceImpl &rhs)
```

Default and copy constructors.

## Clear¶

```
void Clear()
```

Delete and deallocate all data associated with this
surface. This includes all `OEBase` data as
well.

## ClearVertexClique¶

```
bool ClearVertexClique()
```

Sets every vertex clique value to zero. Afterwards,
`OESurface.IsVertexCliqueSet` will return
`false`. This will prevent vertex clique values from being
output by `OEWriteSurface`.

## CreateCopy¶

```
OESystem::OEBase *CreateCopy() const
```

## GetAtoms¶

```
bool GetAtoms(unsigned int *atoms) const
```

Fills the memory pointed to by `atoms` with the atom index
associated with every vertex of the surface. The array passed in
should be large enough to hold `GetNumVertices()` unsigned ints.

## GetAtomsElement¶

```
unsigned int GetAtomsElement(unsigned int n) const
```

Retrieves an element from the internal atoms array. The index
`n` should be less than `GetNumVertices()`.

## GetColor¶

```
bool GetColor(float *color) const
bool GetColor(unsigned char *color) const
```

Fills the memory pointed to by `color` with the color associated
with every vertex of the surface. The array passed in should be
large enough to hold `GetNumVertices() * 4` floats or
`GetNumVertices() * 4` unsigned chars, depending on which
overload is used.

## GetColorElement¶

```
void GetColorElement(unsigned int n, float &r, float &g, float &b, float &a) const
void GetColorElement(unsigned int n, unsigned char &r, unsigned char &g,
unsigned char &b, unsigned char &a) const
```

Retrieves an element from the internal color array. The index
`n` should be less than `GetNumVertices()`.

## GetCurvature¶

```
bool GetCurvature(float *curvature) const
```

Fills the memory pointed to by `curvature` with the curvature
associated with every vertex of the surface. The array passed in
should be large enough to hold `GetNumVertices()` floats.

## GetCurvatureElement¶

```
float GetCurvatureElement(unsigned int n) const
```

Retrieves an element from the internal curvature array. The
index `n` should be less than `GetNumVertices()`.

## GetDataType¶

```
const void *GetDataType() const
```

## GetDistance¶

```
bool GetDistance(float *distance) const
```

Fills the memory pointed to by `distance` with the distance each
vertex is from another object. The array passed in should be
large enough to hold `GetNumVertices()` floats.

## GetDistanceElement¶

```
float GetDistanceElement(unsigned int n) const
```

Retrieves an element from the internal distance array. The index
`n` should be less than `GetNumVertices()`.

## GetFaceNormals¶

```
bool GetFaceNormals(float *faceNormals) const
```

Fills the memory pointed to by `faceNormals` with a normal
vector associated with every triangle of the surface. The array
passed in should be large enough to hold `GetNumTriangles() *
3` floats.

## GetFaceNormal¶

```
bool GetFaceNormal(unsigned int n, float *normal) const
```

Retrieves a 3-component face normal vector for the specified triangle
and stores it in the `normal` array.
The index `n` must be less than `GetNumTriangles()`.
Returns `true` upon success.

## GetFaceNormalsElement¶

```
float GetFaceNormalsElement(unsigned int n) const
```

This method has been deprecated. Use
`OESurface.GetFaceNormal` instead.

## GetNormals¶

```
bool GetNormals(float *normals) const
```

Fills the memory pointed to by `normals` with a normal vector
associated with every vertex of the surface. The array passed in
should be large enough to hold `GetNumVertices() * 3`
floats. A vertex normal is calculated by averaging the face
normals of all the triangles in which the vertex resides.

## GetNormal¶

```
bool GetNormal(unsigned int n, float *normal) const
```

Retrieves an 3-component vertex normal for the specified vertex and
stores it in the `normal` array. The index `n` must be less
than `GetNumVertices()`. This method returns `true` upon success.

## GetNormalsElement¶

```
float GetNormalsElement(unsigned int n) const
```

This method has been deprecated. Use
`OESurface.GetNormal` instead.

## GetNumTriangles¶

```
unsigned int GetNumTriangles() const
```

Returns the number of triangles in the surface.

## GetPotential¶

```
bool GetPotential(float *potential) const
```

Fills the memory pointed to by `potential` with the potential
associated with every vertex of the surface. The array passed in
should be large enough to hold `GetNumVertices()` floats.

## GetPotentialElement¶

```
float GetPotentialElement(unsigned int n) const
```

Retrieves an element from the internal potentials array. The index `n`
should be less than `GetNumVertices()`.

## GetPotentialName¶

```
const char *GetPotentialName() const
```

Returns name of the potentials stored in the surface’s potential array.

## GetProbeRadius¶

```
float GetProbeRadius() const
```

Returns the probe radius used in the construction of the surface.

## GetResolution¶

```
float GetResolution() const
```

Returns the grid spacing used in the surface construction.

## GetTriangles¶

```
bool GetTriangles(unsigned int *triangles) const
```

Fills the memory pointed to by `triangles` with the vertex indices
that compose every triangle in the surface. The vertex indices
will obey the clockwise ordering rule described in the
*Triangles* section. The array passed in should be
large enough to hold `GetNumTriangles() * 3` unsigned ints.

## GetTriangle¶

```
bool GetTriangle(unsigned int n, unsigned int *triangle) const
```

Retrieves the three vertex indices for the specified triangle and
stores them in the `triangle` array.
The triangle index `n` must be less than `GetNumTriangles()`.

## GetTrianglesElement¶

```
unsigned int GetTrianglesElement(unsigned int n) const
```

This method has been deprecated. Use
`OESurface.GetTriangle` instead.

## GetVertex¶

```
bool GetVertex(unsigned int n, float *vertex) const
```

Retrieves coordinates for the specified vertex and stores them in the
`vertex` array. The vertex index `n` must be less than
`GetNumVertices()`.

## GetVertexClique¶

```
bool GetVertexClique(unsigned int *vertexClique) const
```

Fills the memory pointed to by `vertexClique` with the clique
values associated with every vertex of the surface. The array
passed in should be large enough to hold `GetNumVertices()`
unsigned ints.

## GetVertexCliqueElement¶

```
unsigned int GetVertexCliqueElement(unsigned int n) const
```

Retrieves an element from the internal cliques array. The index
`n` should be less than `GetNumVertices()`.

## GetVertices¶

```
bool GetVertices(float *vertices) const
```

Fills the memory pointed to by `vertices` with the vertex
coordinates of the surface. Vertices are aligned every three
places in the array as described in the *Vertices*
section. The array passed in should be large enough to hold
`GetNumVertices() * 3` floats.

## GetVerticesElement¶

```
float GetVerticesElement(unsigned int n) const
```

This method has been deprecated. Use
`OESurface.GetVertex` instead.

## IsAtomsSet¶

```
bool IsAtomsSet() const
```

Determine whether the surface has atom indices associated with each
vertex. Surfaces generated from
`OEMakeAccessibleSurface` and
`OEMakeAccessibleSurface`
automatically set this data.

## IsColorSet¶

```
bool IsColorSet() const
```

Determine whether the surface has color values associated with each vertex.

## IsCurvatureSet¶

```
bool IsCurvatureSet() const
```

Determine whether the surface has curvature value calculated for each vertex.

## IsDataType¶

```
bool IsDataType(const void *type) const
```

## IsDistanceSet¶

```
bool IsDistanceSet() const
```

Determine whether the surface has a distance value associated with each vertex.

## IsFaceNormalsSet¶

```
bool IsFaceNormalsSet() const
```

Determine whether the surface has face normals calculated for each triangle.

## IsNormalsSet¶

```
bool IsNormalsSet() const
```

Determine whether the surface has vertex normals calculated for
each vertex. Surfaces generated from
`OEMakeAccessibleSurface` and
`OEMakeAccessibleSurface` automatically set this
data.

## IsPotentialSet¶

```
bool IsPotentialSet() const
```

Determine whether the surface has a potential value associated with each vertex.

## IsVertexCliqueSet¶

```
bool IsVertexCliqueSet() const
```

Determine whether the surface has a clique value associated with each vertex.

## SetAtoms¶

```
bool SetAtoms(const unsigned int *atoms)
```

Sets the internal atoms array data to the values pointed to by
`atoms`. This should be a pointer to an array of unsigned ints
of length `GetNumVertices()`. Returns `true` upon success.

## SetAtomsElement¶

```
bool SetAtomsElement(unsigned int n, unsigned int value)
```

Sets an element in the internal atoms array. The index `n` should be
less than `GetNumVertices()`. Returns `true` upon success.

## SetColor¶

```
bool SetColor(const float *color)
bool SetColor(const unsigned char *color)
```

Sets the internal color array data to the values pointed to by
`color`. This should be a pointer to an array of floats or
unsigned chars of length `GetNumVertices() * 4` or
`GetNumVertices() * 4` respectively. Returns `true` upon
success.

## SetColorElement¶

```
bool SetColorElement(unsigned int n, float r, float g, float b, float a=1.0f)
bool SetColorElement(unsigned int n, unsigned char r, unsigned char g,
unsigned char b, unsigned char a=255)
```

Sets an element in the internal color array. The index `n`
should be less than `GetNumVertices()`. The alpha value,
`a`, defaults to be opaque. Returns `true` upon success.

## SetCurvature¶

```
bool SetCurvature(const float *curvature)
```

Sets the internal curvature array data to the values pointed to by
`curvature`. This should be a pointer to an array of floats of length
`GetNumVertices()`. Returns `true` upon success.

## SetCurvatureElement¶

```
bool SetCurvatureElement(unsigned int n, float value)
```

Sets an element in the internal curvature array. The index `n` should be
less than `GetNumVertices()`. Returns `true` upon success.

## SetDistance¶

```
bool SetDistance(const float *distance)
```

Sets the internal distance array data to the values pointed to
by `distance`. This should be a pointer to an array of floats
of length `GetNumVertices()`. Returns `true` upon success.

## SetDistanceElement¶

```
bool SetDistanceElement(unsigned int n, float value)
```

Sets an element in the internal distance array. The index `n` should be
less than `GetNumVertices`. Returns `true` upon success.

## SetFaceNormal¶

```
bool SetFaceNormal(unsigned int n, const float *normal)
```

Sets the face normal for the specified triangle index. The triangle
index `n` must be less than `GetNumTriangles()`, and `normal`
must contain three elements. Returns `true` upon success.

## SetFaceNormals¶

```
bool SetFaceNormals(const float *faceNormals)
```

Sets the internal face normals array data to the values pointed
to by `faceNormals`. This should be a pointer to an array of
floats of length `GetNumTriangles() * 3`. Face normals are
associated with triangles by their location in the
array. Returns `true` upon success.

## SetFaceNormalsElement¶

```
bool SetFaceNormalsElement(unsigned int n, float value)
```

This method has been deprecated. Use
`OESurface.SetFaceNormal` instead.

## SetNormal¶

```
bool SetNormal(unsigned int n, const float *normal)
```

Sets the vertex normal for the specified vertex. The vertex
index `n` must be less than `GetNumVertices()`, and
`normal` must contain three elements. Returns `true`
upon success.

## SetNormals¶

```
bool SetNormals(const float *normals)
```

Sets the internal vertex normals array data to the values
pointed to by `normals`. This should be a pointer to an array
of floats of length `GetNumVertices() * 3`. Vertex normals are
associated with vertices by their location in the array. Returns
`true` upon success.

## SetNormalsElement¶

```
bool SetNormalsElement(unsigned int n, float value)
```

This method has been deprecated. Use
`OESurface.SetNormal` instead.

## SetNumTriangles¶

```
bool SetNumTriangles(unsigned int n)
```

Warning

Expert use only.

Set the number of triangles in this surface. Setting this to a
value lower than `OESurface.GetNumTriangles`
effectively erases triangles from the surface. The memory for
the `OESurface` is not freed immediately, but cached for
reuse. The Clear method should be used if deallocation is
desired. Deallocation is also handled automatically by the
class destructor.

If the user wants to add more triangles to the surface,
SetNumTriangles should be called first to resize the internal
triangles array. Note that the methods for accessing
individual triangles should not be
used after a call to SetNumTriangles. Any data reliant on the
number of triangles should first be set using the array based
methods. This includes
`OESurface.SetTriangles` and
`OESurface.SetFaceNormals`.

## SetNumVertices¶

```
bool SetNumVertices(unsigned int n)
```

Warning

Expert use only.

Set the number of vertices in this surface. Setting this to a
value lower than `GetNumVertices` effectively erases vertices
from the surface. The memory for the `OESurface` is not freed
immediately, but cached for reuse. The
`OESurface.Clear` method should be used if
deallocation is desired. Deallocation is also handled
automatically by the class destructor.

If the user wants to add more vertices to the surface,
`OESurface.SetNumVertices` should be called first
to resize the internal vertices array. Note that the methods for
accessing individual vertices should not be used after a call to
SetNumVertices. Any data
reliant on the number of vertices should first be set using the
array based methods. These include the following:

## SetPotential¶

```
bool SetPotential(const float *potential)
```

Sets the internal potential array data to the values pointed to by
`potential`. This should be a pointer to an array of floats of length
`GetNumVertices() * sizeof(float)`. Returns true upon success.

## SetPotentialElement¶

```
bool SetPotentialElement(unsigned int n, float value)
```

Sets an element in the internal potential array. The index `n` should be
less than `GetNumVertices()`. Returns true upon success.

## SetPotentialName¶

```
void SetPotentialName(const char *name)
```

Set the name of the potentials that are set on the surface.

## SetTitle¶

```
bool SetTitle(const char *title)
bool SetTitle(const std::string &title)
```

Set the title of the surface.

## SetTriangle¶

```
bool SetTriangle(unsigned int n, const unsigned int *triangle)
```

Sets the vertex indices for the specified triangle. The triangle index
`n` must be less than `GetNumTriangles()`, and `triangle` must
contain three elements. Returns `true` upon success.

## SetTriangles¶

```
bool SetTriangles(const unsigned int *triangles)
```

Sets the internal triangles array data to the values pointed to
by `triangles`. This should be a pointer to an array of unsigned
ints of length `GetNumTriangles() * 3`. Returns `true` upon
success.

## SetTrianglesElement¶

```
bool SetTrianglesElement(unsigned int n, unsigned int value)
```

This method is deprecated. Use
`OESurface.SetTriangle` instead.

## SetVertex¶

```
bool SetVertex(unsigned int n, const float *vertex)
```

Sets the coordinates for the specified vertex. The vertex index
`n` must be less than `GetNumVertices()`, and `vertex` must
contain three elements. Returns `true` upon success.

## SetVertexClique¶

```
bool SetVertexClique(const unsigned int *vertexClique)
```

Sets the internal vertex clique array data to the values pointed
to by `vertexClique`. This should be a pointer to an array of
unsigned ints of length `GetNumVertices()`. Returns `true`
upon success.

## SetVertexCliqueElement¶

```
bool SetVertexCliqueElement(unsigned int n, unsigned int value)
```

Sets an element in the internal vertex clique array. The index `n` should be
less than `GetNumVertices()`. Returns `true` upon success.

## SetVertices¶

```
bool SetVertices(const float *vertices)
```

Sets the internal vertices array data to the values pointed to
by `vertices`. This should be a pointer to an array of floats of
length `GetNumVertices() * 3`. Returns `true` upon success.

## SetVerticesElement¶

```
bool SetVerticesElement(unsigned int n, float value)
```

This method is deprecated. Use
`OESurface.SetVertex` instead.