![]() toList collinear :: -> Bool - are all points collinear? collinear = False collinear = False collinear = v1 /= v2 collinear ( v1 : v2 : vs ) | v1 /= v2 = all ( \ v -> isZero $ ( v2 #- v1 ) #* ( v1 #- v ) ) vs | otherwise = collinear ( v2 : vs ) - | 'Vector2d' is used where 'Graphics.OpenSCAD' expects an OpenSCAD - of length 2. v2 = sum $ zipWith ( * ) ( toList v1 ) ( toList v2 ) isZero :: a -> Bool - is a zero vector. ) :: a -> a -> Double - dot product v1 #. class Eq a => Vector a where rVector :: a -> String toList :: a -> ( #* ) :: a -> a -> a - cross product ( #- ) :: a -> a -> a - difference between two vectors ( #. They are used in transformations of - 'Model's of their type. FilePath ( FilePath ) - A vector in 2 or 3-space. Semigroup ( Semigroup ( ( ), sconcat ), Monoid ( mconcat, mempty, mappend ) ) import qualified Data. List ( elemIndices, nub, intercalate ) import qualified Data. SRGB ( channelRed, channelBlue, channelGreen, toSRGB ) import Data. Colour ( Colour, AlphaColour, alphaChannel, darken, over, black ) import Data. var, fn, fs, fa, def, - ** General convenience functions diam, draw, drawL, ( # ), module Colours ) where import Data. ), - * Primitive creation - ** 'Model2d's rectangle, square, circle, polygon, unsafePolygon, projection, importFile, - ** 'Model3d's sphere, box, cube, cylinder, obCylinder, polyhedron, unsafePolyhedron, multMatrix, linearExtrude, rotateExtrude, surface, solid, - * Functions - ** Combinations union, intersection, difference, minkowski, hull, - ** Transformations scale, resize, rotate, translate, mirror, color, transparent, up, - ** Rendering render, renderL, - ** 'Facet's. ![]() Model, Vector, - ** Types aliases with fixed dimensions Model2d, Model3d, Vector2d, Vector3d, - ** Other type aliases Facet, TransMatrix, - ** Type for 'unsafePolyhedron' 'Sides' argument Sides (. OpenSCAD ( - * Types - ** A 'Model' to be rendered, and a 'Vector' that fixes the - number of dimensions it has. It's generally faster than the roundedcube.scad module above, simplier, but less flexible.Graphics/OpenSCAD.hs module Graphics. If you don't care about being able to apply the rounding to individual sides, and always want the whole box rounded, then you might be better off with roundedcube_simple.scad. Roundedcube(size, center, radius, apply_to) Examples and Output: color("Yellow") Specify where to apply the rounded corners. Whether or not to place the object centered on the origin. An integer creates a cube with specified wall distance. Right-click and "Save As." or click to view: roundedcube.scad (1.8 kB) Usage // An vector specifies distance on each axis. Please, no comments about adding a license unless you have anything else to add to the conversation aside from that. I would like for you to share with me about how you imroved the code. If you have ideas for optimizations or code improvements, suggestions or comments, please, Let me know! :) That line can be removed, but then you would always need to pass a vector. Older versions may or may not be compatible with the line that detects whether the size argument is likely an integer or vector. It is compatible with the 2015 builds of OpenSCAD. So at the simplest level you can just switch out "cube" for "roundedcube". The syntax is very similar to the native cube() primitive solid function syntax, This OpenSCAD module allows you to create a cube object with rounded corners. Rounded Corners in OpenSCAD Rounded Corners in OpenSCAD roundedcube.scad
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |