Morpholib

Latest version: v0.10.0

Safety actively analyzes 682387 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 3

0.6.1

Changes
- If unspecified at construction, the `yradius` attribute of `morpho.shapes.Ellipse` now copies `xradius` instead of defaulting to `1`.
- If unspecified at construction, the `theta1` attribute of `morpho.shapes.EllipticalArc` now defaults to `theta0 + 2pi` instead of just `2pi`.

New Features
- Implemented features enabling a simplified workflow for creating longer-form animations.
+ Actors and Layers now have access to the global animation timeline, removing the need to use the idiom `time = mation.lastID()` to insert new actors/keyframes at an animation's current end.
+ `newendkey()` can now be called with no arguments to create a new keyframe at the global animation's end. Equivalent to `newkey(mation.lastID())`.
* Time offsets can be made with respect to the end of the global animation timeline by passing `glob=True` into `newendkey()`:
python
myactor.newendkey(20, glob=True) Make new key 20 frames after current final animation frame.

+ Layers have a new method `affix()` that behaves identically to `append()` except it always appends to the end of the global animation timeline instead of just the layer's local timeline.
- Puppet skits are now easier to make since Actors now have a new `now()` method that returns the current figure the actor is, at the current global animation time index.
- Camera figures now possess a `rotation` attribute that rotates the view counter-clockwise about the current view's center.
+ New `Camera.rotate()` method facilitates this.
- New tween methods `tweenZoomWithMultiplier()` and `tweenZoomJump()` for `Camera` class
+ Enable a camera to change its zoom level in the middle of a zoom tween.
+ Example:
python
Camera will now temporarily zoom out by a factor of 2 in the
middle of a zoom tween.
cam.tweenMethod = morpho.Camera.tweenZoomJump(2)

- Added named side/corner methods to `Image` and `Text` classes and their derivatives.
+ The methods are `left()`, `right()`, `top()`, `bottom()`, `northwest()`, `southwest()`, `southeast()`, and `northeast()`.
+ They return the corresponding position of the figure's physical bounding box.
- Added `glide()` transition function to `morpho.transitions`.
- New `all` property of Frames allows an attribute of all subfigures to be accessed/modified in a single line
+ Example: `myframe.all.color = (1,0,0)`
- Path/Spline `start` and `end` attributes can now go outside the interval [0,1] whereby they will be interpreted cyclically.
- Arrows can now be placed so that the base of the triangle occurs at the path endpoints instead of its tip. This applies for both Paths and Arrow figures.
- New `Path.center()` method returns the center of mass of all nodes in the path.
- Added geometry properties `eccentricity`, `majorRadius`, and `minorRadius` to `morpho.shapes.Ellipse` and also enabled the transformation attributes `rotation` and `transform`.
- `EllipticalArc` now supports the `growIn/shrinkOut()` actor actions.
- Physical and non-physical text paragraphs now possess `width()` and `height()` methods that return the width or height of the paragraph's physical bounding box.

Improvements
- `Frame.merge()` can now handle a raw Figure-type input by interpreting it as a Frame containing a single subfigure.
python
These are now equivalent:
myframe.merge(myfig)
myframe.merge(morpho.Frame([myfig]))

- Detection of (near-)singular matrix transformations is now done more smartly to avoid certain false-positive detections.
- `Camera` and `SpaceCamera` are now accessible from the base morpho namespace: `morpho.Camera` and `morpho.SpaceCamera`.

Bug Fixes
- Setting `tipSize` while `headSize != tailSize` will no longer throw an error.
- The `seamless` optional argument for `newendkey()` is now keyword-only just like its counterpart in `newkey()`.
- For multifigures (`MultiImage`, `MultiText`, etc.), caller-returning methods like `newSource()` that return the figure that called them now correctly return the multifigure object itself, instead of the subfigure, when called directly from the multifigure object.
python
multimg.newSource(...) Correctly returns `multimg` instead of `multimg.figures[0]`

- `box()` method is now correctly disabled for spacefigure classes that used to possess them.
- Fixed a bug with path tweening that could occur if the starting and ending path node counts differed by exactly one node.
- Fixed a bug for 2-node paths in which arrow tip directions would get mixed up if the tip sizes were very large in proportion to the path length.

0.6.0

Changes
- Changed the default behavior of `newkey()` and `newendkey()` when inserting a keyfigure between two existing keyfigures. See below for more info.
+ As a result, the built-in transition function `instant()`/`step()`/`jump()` has been disabled. Instead, set `static=True` or use `tweenMethod=tweenInstant` to achieve the same effect.
- The `figures` parameter in the `Frame` constructor is now positional-only to facilitate naming subfigures (see below).

New Features
- When inserting a new keyfigure between existing keyfigures in an actor using `newkey()` or `newendkey()`, Morpho will now attempt to integrate the new intermediate keyfigure seamlessly into the animation by modifying the transition method of the prior and inserted keyfigures.
+ This behavior can be suppressed by passing in the optional keyword argument `seamless=False`.
- Reworked how retrieving Figure attributes works which should make Morpho run faster particularly for animations containing many actors.
- Subpaths can be extracted from paths using the new `segment()` method or by using Python slice syntax: `mypath[a:b]`
+ This is also true of splines, though it should be considered experimental at this stage.
- `Spline.node()` can now optionally accept in/outhandles as well, making it possible to fully specify a spline's behavior at a node in one line of code.
- `Frame` (and `Frame`-like) figures can now have their component figures assigned names accessible using attribute syntax: `myframe.mypath`
+ This can be done at construction time with the syntax `Frame(name1=figure1, name2=figure2, ...)` or afterward with the `setName()` method.
+ `mathaxes()` now names its component axes `xaxis` and `yaxis` so they can be easily accessed/modified after construction.
- `Frame` figure overall position can now be modified with a new built-in `origin` attribute.
- `Frame` figures now support the basic actor actions `fadeIn/Out()` and `rollback()`.
- `paragraph()` function can now optionally take a Layer/Camera object and/or Animation object as inputs to its required `view` and `windowShape` parameters.
+ This helps streamline the common pattern where `view` is a given layer's latest camera view, and the `windowShape` comes from an `Animation` object's `windowShape`:
python
These are now equivalent:
paragraph(textarray, mylayer, animation, ...)
paragraph(textarray, mylayer.camera.last().view, animation.windowShape, ...)

+ This typecasting also applies to virtually every other `view, windowShape` parameter pair in the methods of the `morpho.text` submodule.
- `Gradient` objects can be sliced using Python slice syntax: `mygrad[a:b]`
+ They are also now reversible using the new `reverse()` method.
- Added `rotation2d()` and `scale2d()` functions to `morpho.matrix`.
- Locator layers now print coordinates to the screen in the form `x+yj` instead of tuple form `(x,y)` to make it easier to copy and paste them into code.
- `Point` actors now support the `growIn()` and `shrinkOut()` actions.
- Added new `blink()` actor action to all figure types. Causes the actor visibility to blink off and on a specified number of times.
- Added coordinate conversion methods to `Camera` class to make converting between different camera coordinate systems easier.

Bug Fixes
- Fixed a bug where outlined paths having dash patterns with very short dash steps would cause a crash.
+ Fixed a similar bug with `Track` objects with extremely small tick spacings.
- Fixed a bug where zero-length `Axis` figures would cause a crash if drawn.
- `Spline.toPath()` will now correctly copy over the spline's dash pattern.
- Fixed a bug in `mathaxes()` where the `tweenMethod` optional argument would be ignored.
- Fixed a bug with locator layers where clicking the screen after the animation has stopped at its final frame would capture the location of the click according to the *first* frame of the animation when replayed. This could cause issues if the starting and ending frames of the animation had differing camera views.
- Fixed a bug where changing an animation's frame rate with `newFrameRate()` would cause the playback timing to sometimes fall out of sync with the original if the original animation contained many delays.
- Fixed an obscure bug that could occur for paths with extremely thin widths. Path widths below 0.5 pixels are no longer drawn.
- Suppressed a numpy warning that would be thrown in `Spline.commitTransforms()`
- (fixed in 0.5.1) Fixed a bug where rotating an `Image` figure after having scaled its `width` attribute unlinked from its `height` would cause the image to be horizontally scaled *after* rotation, instead of before.
- (fixed in 0.5.1) Tickmarks of `mathaxes()` are now centered better.

0.5.1

Bug Fixes
- Fixed a bug where rotating an `Image` figure after having scaled its `width` attribute unlinked from its `height` would cause the image to be horizontally scaled *after* rotation, instead of before.
- Tickmarks of `mathaxes()` are now centered better.

0.5.0

Changes
- Values supplied to the `in/outhandle` optional arguments of `Spline.newNode()` are now interpreted as relative by default. This can be suppressed by passing in the optional kwarg `relHandles=False`.
+ This change should make manually constructing splines a lot simpler.
- Added `trange` argument to `morpho.grid.insertNodesUniformlyTo()` and made `close` a keyword-only argument.


New Features
- New `morpho.text.paragraph()` function can be used to create something close to a multi-line, variable style Text figure.
- New `PText` and `SpacePText` figures can be used to create Text figures that are physically sized (i.e. scale according to camera zoom).
+ Also there is a `paragraphPhys()` function to make physically sized multi-line Text figures.
- Color patterns and heatmaps can now be created using the `colorPattern()` and `heatmap()` functions found in `morpho.graphics`.
+ **Note:** These haven't been very well tested yet, and should probably still be viewed as experimental.
- New `morpho.grid.mathaxes()` function creates a `Frame`-like figure of axes with optional tickmarks.
- `mathgrid()` has new parameters that can simultaneously set both the horizontal and vertical versions of various attributes to a common value.
+ e.g. `steps=1` sets `hsteps=1, vsteps=1`.
+ e.g. `spacing=2` sets `dx=2, dy=2`.
- Added `shrinkOut()` actor action to Path-like figures which essentially undoes `growIn()`.
+ Both `growIn()` and `shrinkOut()` can now reverse the direction of growth/shrinkage with a new optional `reverse` keyword-only argument.
- Actor actions like `growIn()` now work for grids created with `mathgrid()`.
- New `morpho.tools.minsec()` function interprets a decimal input as `minutes.seconds` and returns the equivalent number of seconds.
+ Useful in conjunction with `Animation.endDelayUntil()`.
- `Actor.key[]` now supports slicing so actor segments can be extracted using an alternative syntax to `Actor.segment()`.
- The basic 3D unit vectors `ihat`, `jhat`, and `khat` are now included in `morpho.tools.basics`.
- `Layer.merge()` can now handle inputting a list of non-Layer objects.


Bug Fixes
- Fixed a bug where rotating a physical image in a non-square view would visually rotate the image as if it was in a square view.
- The background bounding box of a `Text` figure should now render correctly in a non-square view.
- Fixed an apparent bug in `SpaceText` where its default `text` value was `None` instead of the empty string.

0.4.0

Changes
- Morpho now requires Python 3.8+ to run.
- Morpho now needs pyperclip as a dependency (should be automatically installed when upgraded)
- Removed virtually all method aliases from all classes. This was done to make overriding these methods in subclasses less confusing. The following method aliases were condensed into the following method names:
+ `minkeyID()`, `firstkeyID()` → `firstID()`
+ `maxkeyID()`, `lastkeyID()` → `lastID()`
+ `tweenStep()`, `tweenJump()` → `tweenInstant()`
+ `minkey()`, `firstkey()`, `start()` → `first()`
+ `maxkey()`, `lastkey()`, `end()` → `last()`
+ `reindex()` → `movekey()`
+ `subactor()` → `segment()`
+ `paste()` → `insert()`
+ `frame()` → `time()`
+ `inhandleRelative()`, `inhandlerelative()`, `inhandlerel()` → `inhandleRel()`
+ `outhandleRelative()`, `outhandlerelative()`, `outhandlerel()` → `outhandleRel()`
+ `SpaceSpline.toSpacePath()`, `SpaceSpline.toSpacepath()` → `SpaceSpline.toPath()`
- `Actor.segment()` now rezeros the subactor it returns by default.
- `morpho.color.heatmap` is now a function instead of a constant and must be called to generate a heatmap gradient: `morpho.color.heatmap()`


New Features
- New `set()` method for Figures allows multiple attributes to be set in one line: `mypoint.set(pos=1+1j, size=25, ...)`
- Skits can now be instantiated in a non-default state
- `SkitParameters` can now be invoked using keyword arguments:
python
morpho.SkitParameters(x=1, y=2, z=3, ...)
class MySkit(morpho.Skit):
...

- Locator layers can now optionally round the clicked coordinates and copy them to the clipboard.
- A variety of improvements to actor actions
+ The built-in actions `fadeIn()` and `fadeOut()` now have an optional `jump` parameter enabling most figures to move while fading in or out.
+ Actions can now be called like methods of actors; e.g. `mypoint.fadeIn(...)`
+ Added `growIn()` action for Paths, Splines, and Arrows that animates them appearing by lengthening from a point.
+ Custom actions can be created for any figure class with the syntax
python
MyFigureClass.action
def myaction(...):
...

- `Image` class now has a `center` property that indicates its visual center on screen.
- Added `constrain()` function to `morpho.tools.basics` that constrains an input value between a specified floor and ceiling.
- `Actor.key` now supports subscripting, allowing for a streamlined way to replace a keyfigure: `myactor.key[n] = myNewKeyfigure`
- Camera viewboxes can now be more easily rescaled to a given aspect ratio via the new methods `Camera.rescaleWidth()` and `Camera.rescaleHeight()`.
- `setupSpace/Alt()` can now be given alternate axis colors.
- Implemented `[rel]corners()` and `center()` methods for the `Text` class.
- Added `rgb2hsv()` and `hsv2rgb()` functions to `morpho.color` to convert between RGB and HSV color representations.
- Streamlined creation of tweenables within a Figure class constructor. It can now be specified like this:
python
self.Tweenable("name", value, tags=...)

and there is no longer a need to explicitly call `update()` or `extendState()` afterward.
- Added property `tipSize` to Arrows that allows you to set the head *and* tail sizes simultaneously:
python
The following lines are equivalent
myarrow.tipSize = 30
myarrow.headSize = myarrow.tailSize = 30

- `morpho.shapes.Ellipse` now has a `radius` property that allows you to set the `xradius` and `yradius` properties simultaneously.
- `morpho.grid.ellipse()` `b` argument now defaults to `a`, allowing you to easily specify a circle like this: `morpho.grid.ellipse(center, radius)`.
- Added `formatNumber()` function to `morpho.text` that provides a more streamlined way to format a decimal number into a string.


Bug Fixes
- Fixed bug regarding depth placement of SpacePaths.
- Quadmeshes with gradients now look better when the grid width is zero.
- Arrow tips on Paths and Arrows with gradients should be colored more correctly now.

0.3.0

Changes
- Virtually all functions that accept an input angle value now require the units to be radians.
+ Notable functions/methods affected: `morpho.grid.ellipse()`, `morpho.grid.arc()`, `EllipticalArc.toPath()`, `Pie.toPolygon()`
- Renamed the `fillAlpha` and `edgeAlpha` attributes in `Ellipse` class to `alphaFill` and `alphaEdge`.

New Features
- Added `Track` figure to `morpho.grid`. It's basically a `Path` with tickmarks.
- The `dash` attribute for Paths and Polygons is now tweenable.
- Added `group()` function to `morpho.text` that simulates intratext style variation in a `Text` figure.
- The `beforeActor`/`beforeLayer` optional parameters for the `Layer`/`Animation` `merge()` methods can now also be specified with actual `Actor`/`Layer` objects instead of merely by stack index.
- Custom default font can be set for `Text` class and its derivatives.
- Exports can be given an "export signature", so that two separate Morpho export jobs that have different signatures can be run in parallel without collision.
- `Point` class now has `alphaEdge` and `alphaFill` attributes.
- `fadeOut()` and `rollback()` can now "stagger" their effect across the actors it acts on.
- `EllipticalArc` and `Pie` figures can have their `xradius` and `yradius` set to a common value in one line by setting their new `radius` property.
- Added `windingAngle()` function to `morpho.tools.basics`

Bug Fixes
- Fixed possible bug in `morpho.matrix.rotation()` that could occur if `theta` was unspecified AND `u` was zero.
- Fixed a bug in `Animation.endDelayUntil()` that could occur if called when there was already a non-zero delay on the final frame of the animation.
- Dashed paths with outlines look better now.

Page 2 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.