Better powerful way creation curved path.

Issue #216 resolved
Roman Telezhynskyi repo owner created an issue

Valentina should provide more powerful way creation curved path. In current state user can't control first handle of curve before finish creation. Also Valentina allow edit handler for each next point after first, but user can't change length of handles. Right now user make same work twice.

Comments (17)

  1. Roman Telezhynskyi reporter

    Does this include allowing functions to define control handles?

    Define? What do you mean?

  2. Former user Account Deleted

    I would like to

    create a control handle that points towards another point. How to do that except get an angle between the end point and the other point?

    create a control handle that has angle = ((angle of line from 1st end point) + (angle of line to 2nd end point)) / 2.0

    create a control handle that has angle = (angle of Line_A_B - angleOfDegree(30))

  3. Roman Telezhynskyi reporter

    We can, but it will make unpossible editing curve shape by mouse. Because we will parse expression. You must choose expression or single value. Also there is possibility first check if value is single number, but i not very like such hacks.

    For example we use this trick in this code:

    qreal Calculator::EvalFormula(const QString &formula)
    {
        // Parser doesn't know any variable on this stage. So, we just use variable factory that for each unknown variable
        // set value to 0.
        SetVarFactory(AddVariable, this);
        SetSepForEval();//Reset separators options
    
        SetExpr(formula);
    
        qreal result = 0;
        result = Eval();
    
        QMap<int, QString> tokens = this->GetTokens();
    
        // Remove "-" from tokens list if exist. If don't do that unary minus operation will broken.
        RemoveAll(tokens, QStringLiteral("-"));
    
        if (tokens.isEmpty())
        {
            return result; // We have found only numbers in expression.
        }
    
        // Add variables to parser because we have deal with expression with variables.
        InitVariables(data, tokens, formula);
        return Eval();
    } 
    

    I am pointing to this place:

    if (tokens.isEmpty())
    {
         return result; // We have found only numbers in expression.
    }
    
  4. Susan Spencer

    This is a very important feature. A control handle's angle sometimes should change when the measurements change.

    But I'm not sure I'm the best person to advise you on the implementation choices.

  5. Roman Telezhynskyi reporter

    This is a very important feature. A control handle's angle sometimes should change when the measurements change.

    Ok. I will look more deeply. If use this trick we have chance, but calculation will be slower.

  6. Susan Spencer

    Suggestion:

    No need to enter formulas in the Curve dialog, just select existing points.

    Issue #318 'Create Angle of Line user function' and issue #317 'Create Angle of Vector user function' are prerequisites for this issue.

    Necklines and Armscyes need control points that are defined based on the length between the curve endpoints, using angles that are based on the angle between the end points and the angles of the adjacent lines.

  7. Roman Telezhynskyi reporter

    Do you have a suggested test for this feature?

    No, i think you are talking about the issue #395.

    I did only first step, part about creating a curve like in Inkscape.

  8. Log in to comment