optimization.variable.nurbs

This module contains variable classes for NURBS geometries.

This module contains the NurbsPointsVariable and NurbsWeightsVariable classes, which represent variables for the control points and weights of a NurbsGeometry, respectively. These classes inherit from the VariableBehavior class.

Kramer Harrison, 2024

Classes

NurbsPointsVariable(optic, surface_number, ...)

Represents a variable for a NURBS control point.

NurbsWeightsVariable(optic, surface_number, ...)

Represents a variable for a NURBS weight.

class NurbsPointsVariable(optic, surface_number, coeff_index, apply_scaling=True, **kwargs)[source]

Represents a variable for a NURBS control point.

Parameters:
  • optic – The optic object associated with the variable.

  • surface_number – The index of the surface in the optical system.

  • coeff_index – The indices of the control point.

  • apply_scaling – Whether to apply scaling to the variable.

get_value()[source]

Gets the current value of the control point.

Returns:

The current value of the control point.

inverse_scale(scaled_value)[source]

Inverse scales the value of the variable.

Parameters:

scaled_value – The scaled value to inverse scale.

Returns:

The inverse-scaled value.

scale(value)[source]

Scales the value of the variable.

This can be used for improved optimization performance.

Parameters:

value – The value to scale.

Returns:

The scaled value.

update_value(new_value)[source]

Updates the value of the control point.

Parameters:

new_value – The new value of the control point.

class NurbsWeightsVariable(optic, surface_number, coeff_index, apply_scaling=True, **kwargs)[source]

Represents a variable for a NURBS weight.

Parameters:
  • optic – The optic object associated with the variable.

  • surface_number – The index of the surface in the optical system.

  • coeff_index – The indices of the weight.

  • apply_scaling – Whether to apply scaling to the variable.

get_value()[source]

Gets the current value of the weight.

Returns:

The current value of the weight.

inverse_scale(scaled_value)[source]

Inverse scales the value of the variable.

Parameters:

scaled_value – The scaled value to inverse scale.

Returns:

The inverse-scaled value.

scale(value)[source]

Scales the value of the variable.

This can be used for improved optimization performance.

Parameters:

value – The value to scale.

Returns:

The scaled value.

update_value(new_value)[source]

Updates the value of the weight.

Parameters:

new_value – The new value of the weight.