Skip to content

Surface

a surface in nurbs form

degreeU instance-attribute

degreeU: int

degreeV instance-attribute

degreeV: int

rational instance-attribute

rational: bool

pointData instance-attribute

pointData: List[float]

countU instance-attribute

countU: int

countV instance-attribute

countV: int

knotsU instance-attribute

knotsU: List[float]

knotsV instance-attribute

knotsV: List[float]

domainU instance-attribute

domainU: Interval

domainV instance-attribute

domainV: Interval

closedU instance-attribute

closedU: bool

closedV instance-attribute

closedV: bool

area property writable

area: float

get_control_points

get_control_points() -> List

gets the control points of this surface

Source code in src/specklepy/objects/geometry/surface.py
def get_control_points(self) -> List:
    """
    gets the control points of this surface
    """

    matrix = [[] for _ in range(self.countU)]

    for i in range(0, len(self.pointData), 4):
        u_index = i // (self.countV * 4)
        x, y, z, w = self.pointData[i : i + 4]
        matrix[u_index].append(
            ControlPoint(x=x, y=y, z=z, weight=w, units=self.units)
        )

    return matrix

set_control_points

set_control_points(value: List) -> None

sets the control points of this surface

Source code in src/specklepy/objects/geometry/surface.py
def set_control_points(self, value: List) -> None:
    """
    sets the control points of this surface
    """
    data = []
    self.countU = len(value)
    self.countV = len(value[0])

    for row in value:
        for pt in row:
            data.extend([pt.x, pt.y, pt.z, pt.weight])

    self.pointData = data