More docs for Plane, Pi, etc. (#6850)
* Document the units of PI Signed-off-by: Nick Cameron <nrc@ncameron.org> * Add links between lang and std references Signed-off-by: Nick Cameron <nrc@ncameron.org> * Change signature of conversion functions Signed-off-by: Nick Cameron <nrc@ncameron.org> * Split foreign imports out of modules docs Signed-off-by: Nick Cameron <nrc@ncameron.org> * More docs for Plane Signed-off-by: Nick Cameron <nrc@ncameron.org> * Update docs/kcl-std/consts/std-math-PI.md Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * Update rust/kcl-lib/std/math.kcl Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
This commit is contained in:
@ -7,6 +7,14 @@ import Point2d from "std::types"
|
||||
|
||||
/// The value of `pi`, Archimedes’ constant (π).
|
||||
///
|
||||
/// `PI` is a number and is technically a ratio, so you might expect it to have type `number(_)`.
|
||||
/// However, `PI` is nearly always used for converting between different units - usually degrees to or
|
||||
/// from radians. Therefore, `PI` is treated a bit specially by KCL and always has unknown units. This
|
||||
/// means that if you use `PI`, you will need to give KCL some extra information about the units of numbers.
|
||||
/// Usually you should use type ascription on the result of calculations, e.g., `(2 * PI): number(rad)`.
|
||||
/// You might prefer to use `units::toRadians` or `units::toDegrees` to convert between angles with
|
||||
/// different units.
|
||||
///
|
||||
/// ```
|
||||
/// circumference = 70
|
||||
///
|
||||
|
Reference in New Issue
Block a user