Coder Social home page Coder Social logo

pynurbs's People

Contributors

carlos-adir avatar

Stargazers

 avatar  avatar

Watchers

 avatar

pynurbs's Issues

Implement sum of two curves

To implement the sum of two different curves:

  • Verify if we can sum both curves:
    • The knot vector is the same
  • Sum the control points

Function ```normalize``` in ```KnotVector``` should consider float precision

Take the knotvector

from compmec.nurbs import KnotVector
knotvector = (0.0, 0.0, 1.8678173101311735, 1.8678173101311735)
knotvector = KnotVector(knotvector)
knotvector.normalize()
print(knotvector)  # (0.0, 0.0, 0.9999999999999999, 0.9999999999999999)

It's expected to get the knotvector (0.0, 0.0, 1.0, 1.0)

Degree increase/reduction should accept parameter ```times = 0```, which does nothing

At the version v1.0.8, calling degree_increase or degree_decrease raises a ValueError when the parameter times = 0 is given.
It should do nothing in that case.

Steps to reproduce:

from compmec.nurbs import Curve

knotvector = (0, 0, 0, 1, 1, 1)  # degree 2, npts 3
curve = Curve(knotvector)
curve.degree_increase(0)  # Raises ValueError
curve.degree_decrease(0)  # Raises ValueError
curve.degree = 2  # Does nothing since degree is already 2

Spline/Rational curve accept float values

Currently, the code accepts only ControlPoints as a vector, but for a single value it should return a value

import numpy as np
U = KnotVector([0, 0, 0, 0.5, 1, 1, 1]) # p = 2, n = 4
N = SplineBaseFunction(U)
P = np.random.rand(4)
C = SplineCurve(N, P)
t = np.linspace(0, 1, 11)
print("C(t),shape =", C(t).shape)  # Should be (11,), not (11, 1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.