Skip to content

feat(converter): add support for Angle type to Logarithm - #3681

Open
Krish2882005 wants to merge 1 commit into
synfig:masterfrom
Krish2882005:feat/log-angle-support
Open

Krish2882005 wants to merge 1 commit into
synfig:masterfrom
Krish2882005:feat/log-angle-support

Conversation

@Krish2882005

Copy link
Copy Markdown

Supersedes #3607
Closes #3582

The Logarithm converter previously only accepted Real values. This PR extends it to support Angle inputs.

Changes:

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @Krish2882005, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Logarithm value node by introducing support for Angle data types. Previously limited to Real values, the converter now intelligently handles Angle inputs by converting them to radians for computation and then back to Angle for the result. This change broadens the utility of the Logarithm node within the system and includes updated documentation for clarity.

Highlights

  • Angle Type Support: The Logarithm value node now supports Angle inputs in addition to Real values, enhancing its applicability.
  • Angle Conversion Logic: Angle inputs are automatically converted to radians for logarithmic calculations and then converted back to Angle for the output, ensuring correct mathematical operations.
  • Logic Refinement: The implementation incorporates fixes and improvements from a previously stalled pull request (feat: Add support for Angle type to ValueNode_Logarithm (Log converter) #3607).
  • Documentation: Comprehensive class documentation has been added to valuenode_log.h for ValueNode_Logarithm, detailing its purpose and input types.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • synfig-core/src/synfig/valuenodes/valuenode_log.cpp
    • The constructor ValueNode_Logarithm::ValueNode_Logarithm was updated to conditionally convert initial Angle values to Real (radians) before exp() calculation and then convert the result back to Angle if the node's type is type_angle.
    • ValueNode_Logarithm::set_link_vfunc now uses get_type() for the link_ parameter's type check, allowing it to dynamically accept type_real or type_angle.
    • The ValueNode_Logarithm::operator() method was modified to handle Angle inputs by converting them to radians for log() calculation and converting the -infinite or log(link) result back to Angle if the node's type is type_angle.
    • The ValueNode_Logarithm::check_type method was updated to return true for both type_real and type_angle, enabling the node to accept Angle types.
  • synfig-core/src/synfig/valuenodes/valuenode_log.h
    • Added a Doxygen-style class comment block for ValueNode_Logarithm, explaining its purpose, input types, and the conversion of Angle inputs to radians.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@github-actions

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown

Thank you for contributing!
Below is how your contribution will appear in Synfig's release notes. Review it and improve your pull request's title and description so that your contribution is clear. You can add images, videos, and anything else you want. Have fun!

✨ New Features

  • (Converter Related) Add support for Angle type to Logarithm

    Supersedes #3607
    Closes #3582

    The Logarithm converter previously only accepted Real values. This PR extends it to support Angle inputs.

    Changes:

    • Modified check_type to accept type_angle.
    • Modified operator() to convert Angle inputs to radians (Real) before calculation, then convert the result back to Angle if necessary.
    • Fixed the logic from the stale PR #3607.
    • Added missing class documentation in valuenode_log.h.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully extends the Logarithm converter to support Angle inputs, which is a valuable enhancement. The changes correctly integrate Angle type handling by converting values to radians for internal calculations and back to Angle for output. The addition of class documentation is also a positive improvement. However, there is a critical logical error in the ValueNode_Logarithm constructor that causes the node to return the input value rather than its logarithm.

@Svarov-RZM Svarov-RZM self-assigned this Feb 17, 2026
@Svarov-RZM

Copy link
Copy Markdown
Contributor

OK, the code works but why are we using 1 radian as a base for logarithm instead of 'e'? Is there some meaning to this I am unaware of?

@Krish2882005

Krish2882005 commented Mar 13, 2026 •

Copy link
Copy Markdown
Author

Hey @Svarov-RZM, thanks for taking a look! There seems to be a confusion here. The log() function actually defaults to base e. The code just converts the angle into radians so it can be passed into log(). 1 radian isn't acting as the base here.

@Svarov-RZM

Copy link
Copy Markdown
Contributor

The code just converts the angle into radians so it can be passed into log()

Oh, I see now. Log of 1 equals 'e' but in your case, it equals to 58,3 degrees because you converted it to radians:
Log

So again, is there a point in converting angle to radians instead of passing it as a real? I am not strong in math so that's why I am asking if it's a desired behavior because Link is originally in degrees, not radians.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Add support of Angle type to Log converter

2 participants