2024-12-01 15:52:02 +00:00
<!doctype html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1, minimum-scale=1" >
< meta name = "generator" content = "pdoc3 0.11.3" >
< title > openscad_py.point API documentation< / title >
< meta name = "description" content = "" >
< link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity = "sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin >
< link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity = "sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin >
< link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin >
< style > : root { --highlight-color : #fe9 } . flex { display : flex !important } body { line-height : 1.5 em } # content { padding : 20 px } # sidebar { padding : 1.5 em ; overflow : hidden } # sidebar > * : last-child { margin-bottom : 2 cm } . http-server-breadcrumbs { font-size : 130 % ; margin : 0 0 15 px 0 } # footer { font-size : .75 em ; padding : 5 px 30 px ; border-top : 1 px solid #ddd ; text-align : right } # footer p { margin : 0 0 0 1 em ; display : inline-block } # footer p : last-child { margin-right : 30 px } h1 , h2 , h3 , h4 , h5 { font-weight : 300 } h1 { font-size : 2.5 em ; line-height : 1.1 em } h2 { font-size : 1.75 em ; margin : 2 em 0 .50 em 0 } h3 { font-size : 1.4 em ; margin : 1.6 em 0 .7 em 0 } h4 { margin : 0 ; font-size : 105 % } h1 : target , h2 : target , h3 : target , h4 : target , h5 : target , h6 : target { background : var ( - - highlight - color ) ; padding : .2 em 0 } a { color : #058 ; text-decoration : none ; transition : color .2 s ease-in-out } a : visited { color : #503 } a : hover { color : #b62 } . title code { font-weight : bold } h2 [ id ^ = "header-" ] { margin-top : 2 em } . ident { color : #900 ; font-weight : bold } pre code { font-size : .8 em ; line-height : 1.4 em ; padding : 1 em ; display : block } code { background : #f3f3f3 ; font-family : "DejaVu Sans Mono" , monospace ; padding : 1 px 4 px ; overflow-wrap : break-word } h1 code { background : transparent } pre { border-top : 1 px solid #ccc ; border-bottom : 1 px solid #ccc ; margin : 1 em 0 } # http-server-module-list { display : flex ; flex-flow : column } # http-server-module-list div { display : flex } # http-server-module-list dt { min-width : 10 % } # http-server-module-list p { margin-top : 0 } . toc ul , # index { list-style-type : none ; margin : 0 ; padding : 0 } # index code { background : transparent } # index h3 { border-bottom : 1 px solid #ddd } # index ul { padding : 0 } # index h4 { margin-top : .6 em ; font-weight : bold } @ media ( min-width : 200ex ) { # index . two-column { column-count : 2 } } @ media ( min-width : 300ex ) { # index . two-column { column-count : 3 } } dl { margin-bottom : 2 em } dl dl : last-child { margin-bottom : 4 em } dd { margin : 0 0 1 em 3 em } # header-classes + dl > dd { margin-bottom : 3 em } dd dd { margin-left : 2 em } dd p { margin : 10 px 0 } . name { background : #eee ; font-size : .85 em ; padding : 5 px 10 px ; display : inline-block ; min-width : 40 % } . name : hover { background : #e0e0e0 } dt : target . name { background : var ( - - highlight - color ) } . name > span : first-child { white-space : nowrap } . name . class > span : nth-child ( 2 ) { margin-left : .4 em } . inherited { color : #999 ; border-left : 5 px solid #eee ; padding-left : 1 em } . inheritance em { font-style : normal ; font-weight : bold } . desc h2 { font-weight : 400 ; font-size : 1.25 em } . desc h3 { font-size : 1 em } . desc dt code { background : inherit } . source summary , . git-link-div { color : #666 ; text-align : right ; font-weight : 400 ; font-size : .8 em ; text-transform : uppercase } . source summary > * { white-space : nowrap ; cursor : pointer } . git-link { color : inherit ; margin-left : 1 em } . source pre { max-height : 500 px ; overflow : auto ; margin : 0 } . source pre code { font-size : 12 px ; overflow : visible } . hlist { list-style : none } . hlist li { display : inline } . hlist li : after { content : ',\2002' } . hlist li : last-child : after { content : none } . hlist . hlist { display : inline ; padding-left : 1 em } img { max-width : 100 % } td { padding : 0 .5 em } . admonition { padding : .1 em 1 em ; margin : 1 em 0 } . admonition-title { font-weight : bold } . admonition . note , . admonition . info , . admonition . important { background : #aef } . admonition . todo , . admonition . versionadded , . admonition . tip , . admonition . hint { background : #dfd } . admonition . warning , . admonition . versionchanged , . admonition . deprecated { background : #fd4 } . admonition . error , . admonition . danger , . admonition . caution { background : lightpink } < / style >
< style media = "screen and (min-width: 700px)" > @ media screen and ( min-width : 700px ) { # sidebar { width : 30 % ; height : 100 vh ; overflow : auto ; position : sticky ; top : 0 } # content { width : 70 % ; max-width : 100 ch ; padding : 3 em 4 em ; border-left : 1 px solid #ddd } pre code { font-size : 1 em } . name { font-size : 1 em } main { display : flex ; flex-direction : row-reverse ; justify-content : flex-end } . toc ul ul , # index ul ul { padding-left : 1 em } . toc > ul > li { margin-top : .5 em } } < / style >
< style media = "print" > @ media print { # sidebar h1 { page-break-before : always } . source { display : none } } @ media print { * { background : transparent !important ; color : #000 !important ; box-shadow : none !important ; text-shadow : none !important } a [ href ] : after { content : " (" attr ( href ) ")" ; font-size : 90 % } a [ href ] [ title ] : after { content : none } abbr [ title ] : after { content : " (" attr ( title ) ")" } . ir a : after , a [ href ^ = "javascript:" ] : after , a [ href ^ = "#" ] : after { content : "" } pre , blockquote { border : 1 px solid #999 ; page-break-inside : avoid } thead { display : table-header-group } tr , img { page-break-inside : avoid } img { max-width : 100 % !important } @ page { margin : 0 . 5cm } p , h2 , h3 { orphans : 3 ; widows : 3 } h1 , h2 , h3 , h4 , h5 , h6 { page-break-after : avoid } } < / style >
< script defer src = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity = "sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin > < / script >
< script > w i n d o w . a d d E v e n t L i s t e n e r ( ' D O M C o n t e n t L o a d e d ' , ( ) = > {
hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']});
hljs.highlightAll();
})< / script >
< / head >
< body >
< main >
< article id = "content" >
< header >
< h1 class = "title" > Module < code > openscad_py.point< / code > < / h1 >
< / header >
< section id = "section-intro" >
< / section >
< section >
< / section >
< section >
< / section >
< section >
< / section >
< section >
< h2 class = "section-title" id = "header-classes" > Classes< / h2 >
< dl >
< dt id = "openscad_py.point.Point" > < code class = "flex name class" >
< span > class < span class = "ident" > Point< / span > < / span >
2024-12-02 19:39:58 +00:00
< span > (< / span > < span > coords: List[float])< / span >
2024-12-01 15:52:02 +00:00
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Represents a point or vector in arbitrary number of dimensions< / p > < / div >
2024-12-01 15:52:02 +00:00
< details class = "source" >
< summary >
< span > Expand source code< / span >
< / summary >
< pre > < code class = "python" > class Point:
2024-12-02 19:39:58 +00:00
" " " Represents a point or vector in arbitrary number of dimensions" " "
2024-12-01 15:52:02 +00:00
2024-12-02 19:39:58 +00:00
def __init__(self, coords: List[float]):
2024-12-01 15:52:02 +00:00
self.c = np.array(coords, dtype=NP_TYPE)
@classmethod
2024-12-02 19:39:58 +00:00
def c(cls, coords: TUnion[list[float], ' Point' ]) -> ' Point' :
" " " Ensure `coords` is an instance of Point (idempotent)" " "
2024-12-01 15:52:02 +00:00
if isinstance(coords, Point):
return coords
return Point(coords)
def render(self) -> str:
2024-12-02 19:39:58 +00:00
" " " Render the point / vector into OpenSCAD code" " "
2024-12-01 15:52:02 +00:00
return " [" + (" ," .join([str(c) for c in self.c])) + " ]"
def render_stl(self) -> str:
2024-12-02 19:39:58 +00:00
" " " Render the point / vector into STL" " "
2024-12-01 15:52:02 +00:00
return " " .join([str(c) for c in self.c])
def scale(self, x: float) -> ' Point' :
2024-12-02 19:39:58 +00:00
" " " Scale the current point / vector by the scalar `x`" " "
2024-12-01 15:52:02 +00:00
return self.__class__(self.c * x)
def add(self, p: ' Point' ) -> ' Point' :
2024-12-02 19:39:58 +00:00
" " " Add another point / vector `p` to the current one" " "
2024-12-01 15:52:02 +00:00
assert isinstance(p, Point)
assert self.dim() == p.dim()
return self.__class__(self.c + p.c)
def sub(self, p: ' Point' ) -> ' Point' :
2024-12-02 19:39:58 +00:00
" " " Subtract another point / vector `p` from the current one" " "
2024-12-01 15:52:02 +00:00
assert isinstance(p, Point)
assert self.dim() == p.dim()
return self.__class__(self.c - p.c)
def dim(self) -> int:
" " " Return the number of dimensions" " "
return self.c.shape[0]
def is_zero(self) -> bool:
" " " Return whether all coordinates are very close to 0" " "
return np.all(np.abs(self.c) < EPSILON)
def length(self) -> float:
" " " Return the length of the vector" " "
return np.sqrt(np.square(self.c).sum())
def norm(self) -> ' Point' :
2024-12-02 19:39:58 +00:00
" " " Return a normalized version of the vector (scaled to length 1)" " "
2024-12-01 15:52:02 +00:00
l = self.length()
if l == 0:
2024-12-02 19:39:58 +00:00
raise Exception(" Attempted to normalise 0 vector" )
2024-12-01 15:52:02 +00:00
return self.__class__(self.c / self.length())
def dot(self, p: ' Point' ) -> float:
2024-12-02 19:39:58 +00:00
" " " Return the dot product of the current vector and `p`" " "
2024-12-01 15:52:02 +00:00
return np.dot(self.c, p.c)
def cross(self, p: ' Point' ) -> ' Point' :
2024-12-02 19:39:58 +00:00
" " " Return the cross product of the current vector and `p`" " "
2024-12-01 15:52:02 +00:00
assert self.dim() == 3
assert p.dim() == 3
return Point([
self.c[1]*p.c[2] - self.c[2]*p.c[1],
self.c[2]*p.c[0] - self.c[0]*p.c[2],
self.c[0]*p.c[1] - self.c[1]*p.c[0]
])
def eq(self, p: ' Point' ) -> bool:
2024-12-02 19:39:58 +00:00
" " " Return whether the current point / vector and `p` are equal" " "
2024-12-01 15:52:02 +00:00
return (self.c == p.c).all()
def lt(self, p: ' Point' ) -> bool:
2024-12-02 19:39:58 +00:00
" " " Return whether the current vector is smaller than `p` in each dimension" " "
2024-12-01 15:52:02 +00:00
return (self.c < p.c).all()
def le(self, p: ' Point' ) -> bool:
2024-12-02 19:39:58 +00:00
" " " Return whether the current vector is smaller or equal to `p` in each dimension" " "
2024-12-01 15:52:02 +00:00
return (self.c < = p.c).all()
def gt(self, p: ' Point' ) -> bool:
2024-12-02 19:39:58 +00:00
" " " Return whether the current vector is greater than `p` in each dimension" " "
2024-12-01 15:52:02 +00:00
return (self.c > p.c).all()
def ge(self, p: ' Point' ) -> bool:
2024-12-02 19:39:58 +00:00
" " " Return whether the current vector is greater or equal to `p` in each dimension" " "
2024-12-01 15:52:02 +00:00
return (self.c > = p.c).all()
def allclose(self, p: ' Point' ) -> bool:
2024-12-02 19:39:58 +00:00
" " " Return whether the current point / vector and `p` are close to each other" " "
2024-12-01 15:52:02 +00:00
return self.c.shape == p.c.shape and np.allclose(self.c, p.c)
def angle(self, p: ' Point' , mode: str = " deg" ) -> float:
2024-12-02 19:39:58 +00:00
" " " Return the angle between two vectors in degrees or radians
Arguments:
- p: a Point object
- mode: " deg" | " rad"
" " "
2024-12-01 15:52:02 +00:00
r = self.dot(p)
r = r / self.length() / p.length()
r = math.acos(r)
if mode == " rad" :
return r
if mode == " deg" :
return r / math.pi * 180.
raise ValueError(" Unknown mode" )
def z_slope(self, mode: str = " deg" ) -> float:
2024-12-02 19:39:58 +00:00
" " " Return the slope of a vector in degrees or radians
Arguments:
- mode: " deg" | " rad"
" " "
2024-12-01 15:52:02 +00:00
r = self.c[2] / self.length()
r = math.asin(r)
if mode == " rad" :
return r
if mode == " deg" :
return r / math.pi * 180.
raise ValueError(" Unknown mode" )
def rotate(self, coords, angle: float) -> ' Point' :
2024-12-02 19:39:58 +00:00
" " " Rotate the current vector
Arguments:
- coords: A list of 2 coordinate indices to rotate
- angle: the angle to rotate by, in degrees
" " "
2024-12-01 15:52:02 +00:00
assert len(coords) == 2
ca, cb = coords
s = np.sin(angle / 180. * np.pi)
c = np.cos(angle / 180. * np.pi)
r = self.clone().reset_cache()
r.c[ca] = c * self.c[ca] + s * self.c[cb]
r.c[cb] = -s * self.c[ca] + c * self.c[cb]
return r
# Operator overloading
def __add__(self, other):
2024-12-02 19:39:58 +00:00
" " " Use `p1 + p2` to add two vectors" " "
2024-12-01 15:52:02 +00:00
return self.add(other)
def __radd__(self, other):
2024-12-02 19:39:58 +00:00
" " " Use `p1 + p2` to add two vectors" " "
2024-12-01 15:52:02 +00:00
assert isinstance(other, Point)
return other.add(self)
def __sub__(self, other):
2024-12-02 19:39:58 +00:00
" " " Use `p1 - p2` to subtract two vectors" " "
2024-12-01 15:52:02 +00:00
return self.sub(other)
def __rsub__(self, other):
2024-12-02 19:39:58 +00:00
" " " Use `p1 - p2` to subtract two vectors" " "
2024-12-01 15:52:02 +00:00
assert isinstance(other, Point)
return other.sub(self)
def __mul__(self, other):
2024-12-02 19:39:58 +00:00
" " " Use `p * x` to scale a vector" " "
2024-12-01 15:52:02 +00:00
return self.scale(other)
def __rmul__(self, other):
2024-12-02 19:39:58 +00:00
" " " Use `x * p` to scale a vector" " "
2024-12-01 15:52:02 +00:00
return self.scale(other)
def __neg__(self):
2024-12-02 19:39:58 +00:00
" " " Use `-p` to negate a vector" " "
2024-12-01 15:52:02 +00:00
return self.scale(-1.)< / code > < / pre >
< / details >
< h3 > Static methods< / h3 >
< dl >
< dt id = "openscad_py.point.Point.c" > < code class = "name flex" >
< span > def < span class = "ident" > c< / span > < / span > (< span > coords: list | ForwardRef('< a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ')) ‑ > < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > < / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Ensure < code > coords< / code > is an instance of Point (idempotent)< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< / dl >
< h3 > Methods< / h3 >
< dl >
2024-12-02 19:39:58 +00:00
< dt id = "openscad_py.point.Point.__add__" > < code class = "name flex" >
< span > def < span class = "ident" > __add__< / span > < / span > (< span > self, other)< / span >
< / code > < / dt >
< dd >
< div class = "desc" > < p > Use < code > p1 + p2< / code > to add two vectors< / p > < / div >
< / dd >
< dt id = "openscad_py.point.Point.__mul__" > < code class = "name flex" >
< span > def < span class = "ident" > __mul__< / span > < / span > (< span > self, other)< / span >
< / code > < / dt >
< dd >
< div class = "desc" > < p > Use < code > p * x< / code > to scale a vector< / p > < / div >
< / dd >
< dt id = "openscad_py.point.Point.__neg__" > < code class = "name flex" >
< span > def < span class = "ident" > __neg__< / span > < / span > (< span > self)< / span >
< / code > < / dt >
< dd >
< div class = "desc" > < p > Use < code > -p< / code > to negate a vector< / p > < / div >
< / dd >
< dt id = "openscad_py.point.Point.__rmul__" > < code class = "name flex" >
< span > def < span class = "ident" > __rmul__< / span > < / span > (< span > self, other)< / span >
< / code > < / dt >
< dd >
< div class = "desc" > < p > Use < code > x * p< / code > to scale a vector< / p > < / div >
< / dd >
< dt id = "openscad_py.point.Point.__sub__" > < code class = "name flex" >
< span > def < span class = "ident" > __sub__< / span > < / span > (< span > self, other)< / span >
< / code > < / dt >
< dd >
< div class = "desc" > < p > Use < code > p1 - p2< / code > to subtract two vectors< / p > < / div >
< / dd >
2024-12-01 15:52:02 +00:00
< dt id = "openscad_py.point.Point.add" > < code class = "name flex" >
< span > def < span class = "ident" > add< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ) ‑ > < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > < / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Add another point / vector < code > p< / code > to the current one< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.allclose" > < code class = "name flex" >
< span > def < span class = "ident" > allclose< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ) ‑ > bool< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return whether the current point / vector and < code > p< / code > are close to each other< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.angle" > < code class = "name flex" >
< span > def < span class = "ident" > angle< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ,< br > mode: str = 'deg') ‑ > float< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return the angle between two vectors in degrees or radians< / p >
< h2 id = "arguments" > Arguments< / h2 >
< ul >
< li > p: a Point object< / li >
< li > mode: "deg" | "rad"< / li >
< / ul > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.cross" > < code class = "name flex" >
< span > def < span class = "ident" > cross< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ) ‑ > < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > < / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return the cross product of the current vector and < code > p< / code > < / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.dim" > < code class = "name flex" >
< span > def < span class = "ident" > dim< / span > < / span > (< span > self) ‑ > int< / span >
< / code > < / dt >
< dd >
< div class = "desc" > < p > Return the number of dimensions< / p > < / div >
< / dd >
< dt id = "openscad_py.point.Point.dot" > < code class = "name flex" >
< span > def < span class = "ident" > dot< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ) ‑ > float< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return the dot product of the current vector and < code > p< / code > < / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.eq" > < code class = "name flex" >
< span > def < span class = "ident" > eq< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ) ‑ > bool< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return whether the current point / vector and < code > p< / code > are equal< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.ge" > < code class = "name flex" >
< span > def < span class = "ident" > ge< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ) ‑ > bool< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return whether the current vector is greater or equal to < code > p< / code > in each dimension< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.gt" > < code class = "name flex" >
< span > def < span class = "ident" > gt< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ) ‑ > bool< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return whether the current vector is greater than < code > p< / code > in each dimension< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.is_zero" > < code class = "name flex" >
< span > def < span class = "ident" > is_zero< / span > < / span > (< span > self) ‑ > bool< / span >
< / code > < / dt >
< dd >
< div class = "desc" > < p > Return whether all coordinates are very close to 0< / p > < / div >
< / dd >
< dt id = "openscad_py.point.Point.le" > < code class = "name flex" >
< span > def < span class = "ident" > le< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ) ‑ > bool< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return whether the current vector is smaller or equal to < code > p< / code > in each dimension< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.length" > < code class = "name flex" >
< span > def < span class = "ident" > length< / span > < / span > (< span > self) ‑ > float< / span >
< / code > < / dt >
< dd >
< div class = "desc" > < p > Return the length of the vector< / p > < / div >
< / dd >
< dt id = "openscad_py.point.Point.lt" > < code class = "name flex" >
< span > def < span class = "ident" > lt< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ) ‑ > bool< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return whether the current vector is smaller than < code > p< / code > in each dimension< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.norm" > < code class = "name flex" >
< span > def < span class = "ident" > norm< / span > < / span > (< span > self) ‑ > < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > < / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return a normalized version of the vector (scaled to length 1)< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.render" > < code class = "name flex" >
< span > def < span class = "ident" > render< / span > < / span > (< span > self) ‑ > str< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Render the point / vector into OpenSCAD code< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.render_stl" > < code class = "name flex" >
< span > def < span class = "ident" > render_stl< / span > < / span > (< span > self) ‑ > str< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Render the point / vector into STL< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.rotate" > < code class = "name flex" >
< span > def < span class = "ident" > rotate< / span > < / span > (< span > self, coords, angle: float) ‑ > < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > < / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Rotate the current vector< / p >
< h2 id = "arguments" > Arguments< / h2 >
< ul >
< li > coords: A list of 2 coordinate indices to rotate< / li >
< li > angle: the angle to rotate by, in degrees< / li >
< / ul > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.scale" > < code class = "name flex" >
< span > def < span class = "ident" > scale< / span > < / span > (< span > self, x: float) ‑ > < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > < / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Scale the current point / vector by the scalar < code > x< / code > < / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.sub" > < code class = "name flex" >
< span > def < span class = "ident" > sub< / span > < / span > (< span > self,< br > p: < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > ) ‑ > < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > < / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Subtract another point / vector < code > p< / code > from the current one< / p > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< dt id = "openscad_py.point.Point.z_slope" > < code class = "name flex" >
< span > def < span class = "ident" > z_slope< / span > < / span > (< span > self, mode: str = 'deg') ‑ > float< / span >
< / code > < / dt >
< dd >
2024-12-02 19:39:58 +00:00
< div class = "desc" > < p > Return the slope of a vector in degrees or radians< / p >
< h2 id = "arguments" > Arguments< / h2 >
< ul >
< li > mode: "deg" | "rad"< / li >
< / ul > < / div >
2024-12-01 15:52:02 +00:00
< / dd >
< / dl >
< / dd >
< / dl >
< / section >
< / article >
< nav id = "sidebar" >
< div class = "toc" >
< ul > < / ul >
< / div >
< ul id = "index" >
< li > < h3 > Super-module< / h3 >
< ul >
< li > < code > < a title = "openscad_py" href = "index.html" > openscad_py< / a > < / code > < / li >
< / ul >
< / li >
< li > < h3 > < a href = "#header-classes" > Classes< / a > < / h3 >
< ul >
< li >
< h4 > < code > < a title = "openscad_py.point.Point" href = "#openscad_py.point.Point" > Point< / a > < / code > < / h4 >
< ul class = "two-column" >
2024-12-02 19:39:58 +00:00
< li > < code > < a title = "openscad_py.point.Point.__add__" href = "#openscad_py.point.Point.__add__" > __add__< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.__mul__" href = "#openscad_py.point.Point.__mul__" > __mul__< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.__neg__" href = "#openscad_py.point.Point.__neg__" > __neg__< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.__rmul__" href = "#openscad_py.point.Point.__rmul__" > __rmul__< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.__sub__" href = "#openscad_py.point.Point.__sub__" > __sub__< / a > < / code > < / li >
2024-12-01 15:52:02 +00:00
< li > < code > < a title = "openscad_py.point.Point.add" href = "#openscad_py.point.Point.add" > add< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.allclose" href = "#openscad_py.point.Point.allclose" > allclose< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.angle" href = "#openscad_py.point.Point.angle" > angle< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.c" href = "#openscad_py.point.Point.c" > c< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.cross" href = "#openscad_py.point.Point.cross" > cross< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.dim" href = "#openscad_py.point.Point.dim" > dim< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.dot" href = "#openscad_py.point.Point.dot" > dot< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.eq" href = "#openscad_py.point.Point.eq" > eq< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.ge" href = "#openscad_py.point.Point.ge" > ge< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.gt" href = "#openscad_py.point.Point.gt" > gt< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.is_zero" href = "#openscad_py.point.Point.is_zero" > is_zero< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.le" href = "#openscad_py.point.Point.le" > le< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.length" href = "#openscad_py.point.Point.length" > length< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.lt" href = "#openscad_py.point.Point.lt" > lt< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.norm" href = "#openscad_py.point.Point.norm" > norm< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.render" href = "#openscad_py.point.Point.render" > render< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.render_stl" href = "#openscad_py.point.Point.render_stl" > render_stl< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.rotate" href = "#openscad_py.point.Point.rotate" > rotate< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.scale" href = "#openscad_py.point.Point.scale" > scale< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.sub" href = "#openscad_py.point.Point.sub" > sub< / a > < / code > < / li >
< li > < code > < a title = "openscad_py.point.Point.z_slope" href = "#openscad_py.point.Point.z_slope" > z_slope< / a > < / code > < / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< / nav >
< / main >
< footer id = "footer" >
< p > Generated by < a href = "https://pdoc3.github.io/pdoc" title = "pdoc: Python API documentation generator" > < cite > pdoc< / cite > 0.11.3< / a > .< / p >
< / footer >
< / body >
< / html >