line
geometry.line
Line module.
Classes:
-
Line–Represents a line in a 3D modelling space.
geometry.line.Line
Line(start_point: Point, end_point: Point)
Represents a line in a 3D modelling space.
Parameters:
-
start_point(Point) –Starting point
-
end_point(Point) –End point
Initialize the line.
Source code in blueprints/geometry/line.py
27 28 29 30 31 32 | |
geometry.line.Line.delta_x
property
delta_x: float
Difference in X-coordinate between starting and end point (X end - X start).
geometry.line.Line.delta_y
property
delta_y: float
Difference in Y-coordinate between starting and end point (Y end - Y start).
geometry.line.Line.delta_z
property
delta_z: float
Difference in Z-coordinate between starting and end point (Z end - Z start).
geometry.line.Line.end_point
property
writable
end_point: Point
Return the end point.
geometry.line.Line.length
property
length: float
Return the total length of the line.
geometry.line.Line.midpoint
property
midpoint: Point
Midpoint of the line.
geometry.line.Line.start_point
property
writable
start_point: Point
Return the start point.
geometry.line.Line.unit_vector
property
unit_vector: ndarray
Return the unit vector of the line.
geometry.line.Line.adjust_length
adjust_length(
distance: float, direction: Literal["start", "end"] = "end"
) -> Self
Extends or shortens the line in a given direction. The end of the line is the default direction.
Parameters:
-
distance(float) –Distance to extend or shorten the line. Positive number extends the line, negative number shortens the line.
-
direction(Literal['start', 'end'], default:'end') –Given direction where the line needs to be extended. Default towards the end of the line.
Returns:
-
Line–The new line with the adjusted length.
Source code in blueprints/geometry/line.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
geometry.line.Line.angle
angle(coordinate_system: CoordinateSystemOptions = XY) -> DEG
Calculates rotation of the end point in relation to the start point in a given plane/coordinate system [deg].
- The rotation is calculated in the given plane in relation to the start point.
- The rotation is calculated in the range [0, 2*pi].
- The rotation is calculated in the counter-clockwise direction.
Parameters:
-
coordinate_system(CoordinateSystemOptions, default:XY) –Desired plane that will be used as reference to calculate the rotation. Standard is XY-plane.
Returns:
-
DEG–rotation of end point relative to the start point in degrees in the given plane [deg].
Source code in blueprints/geometry/line.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
geometry.line.Line.divide_into_n_lines
divide_into_n_lines(n: int = 2) -> list[Line]
Return a list of evenly divided lines.
Parameters:
-
n(int, default:2) –Total number of lines desired. A minimum of 2 lines are required.
Source code in blueprints/geometry/line.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
geometry.line.Line.get_evenly_spaced_points
get_evenly_spaced_points(n: int = 2) -> list[Point]
Return a list of evenly spaced internal points of the line from start to end point with an n number of desired points.
Parameters:
-
n(int, default:2) –Total number of internal points desired. A minimum of 2 points are required.
Source code in blueprints/geometry/line.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
geometry.line.Line.get_internal_point
get_internal_point(
distance: float, reference: Literal["start", "end"] = "start"
) -> Point
Return an internal point within the line in a given distance from the reference point.
Parameters:
-
distance(float) –Distance from the given reference point following the axis of the line
-
reference(Literal['start', 'end'], default:'start') –Reference point in the line where given distance is declared. Default -> "start"
Returns:
-
Point–Internal point within the line in a given distance from the reference point.
Raises:
-
ValueError–If the distance is greater than the total length of the line. If the distance is a negative number.
Source code in blueprints/geometry/line.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |