Skip to content

Eye Square with Rounded Corner - Just a Question, not an Issue #116

Closed

Description

@SergiuPogorDev

I'm trying to write a new Module Renderer for Eye(internal and external) in order to get Square with Rounded Corner(not circle) but not sure how to get that.

I mean, using matrix logic how to achieve this?

For Circle I use this one:

      ->move(3.5, 0)
      ->ellipticArc(3.5, 3.5, 0., false, true, 0., 3.5)
      ->ellipticArc(3.5, 3.5, 0., false, true, -3.5, 0.)
      ->ellipticArc(3.5, 3.5, 0., false, true, 0., -3.5)
      ->ellipticArc(3.5, 3.5, 0., false, true, 3.5, 0.)
      ->close()
      ->move(2.5, 0)
      ->ellipticArc(2.5, 2.5, 0., false, true, 0., 2.5)
      ->ellipticArc(2.5, 2.5, 0., false, true, -2.5, 0.)
      ->ellipticArc(2.5, 2.5, 0., false, true, 0., -2.5)
      ->ellipticArc(2.5, 2.5, 0., false, true, 2.5, 0.)
      ->close()

Should I focus on replacing ellipticArc with a combination of line() and curve()?

Expected result:
qr-code

Activity

  1. DASPRiD commented on Dec 1, 2022

    @DASPRiD
    Member

    I'd recommend to build it in e.g. Inkscape and have a look at the SVG path code. You can basically do the exact same thing then in code here.

  2. enpesavento commented on Jan 4, 2023

    @enpesavento

    @SergiuPogor I did some experimenting and was able to create something similar using line() and curve().

    I created a new renderer module implementing the EyeInterface and created the paths as follows:

    External Path:

    $outerSize = 3.5;
    $outerMidPoint = 1.0;
    
    $innerSize = 2.5;
    $innerMidPoint = 1.0;
    
    (new Path())
        ->move(0, $outerSize)
        ->line($outerMidPoint, $outerSize)
        ->curve($outerMidPoint, $outerSize, $outerSize, $outerSize, $outerSize, $outerMidPoint)
        ->line($outerSize, 0)
        ->line($outerSize, -$outerMidPoint)
        ->curve($outerSize, -$outerMidPoint, $outerSize, -$outerSize, $outerMidPoint, -$outerSize)
        ->line(0, -$outerSize)
        ->line(-$outerMidPoint, -$outerSize)
        ->curve(-$outerMidPoint, -$outerSize, -$outerSize, -$outerSize, -$outerSize, -$outerMidPoint)
        ->line(-$outerSize, 0)
        ->line(-$outerSize, $outerMidPoint)
        ->curve(-$outerSize, $outerMidPoint, -$outerSize, $outerSize, -$outerMidPoint, $outerSize)
        ->line(0, $outerSize)
        ->close()
    
        ->move(0, $innerSize)
        ->line($innerMidPoint, $innerSize)
        ->curve($innerMidPoint, $innerSize, $innerSize, $innerSize, $innerSize, $innerMidPoint)
        ->line($innerSize, 0)
        ->line($innerSize, -$innerMidPoint)
        ->curve($innerSize, -$innerMidPoint, $innerSize, -$innerSize, $innerMidPoint, -$innerSize)
        ->line(0, -$innerSize)
        ->line(-$innerMidPoint, -$innerSize)
        ->curve(-$innerMidPoint, -$innerSize, -$innerSize, -$innerSize, -$innerSize, -$innerMidPoint)
        ->line(-$innerSize, 0)
        ->line(-$innerSize, $innerMidPoint)
        ->curve(-$innerSize, $innerMidPoint, -$innerSize, $innerSize, -$innerMidPoint, $innerSize)
        ->line(0, $innerSize)
        ->close();
    

    Internal Path:

    $size = 1.5;
    $midPoint = 0.75;
    
    (new Path())
        ->move(0, $size)
        ->line($midPoint, $size)
        ->curve($midPoint, $size, $size, $size, $size, $midPoint)
        ->line($size, 0)
        ->line($size, -$midPoint)
        ->curve($size, -$midPoint, $size, -$size, $midPoint, -$size)
        ->line(0, -$size)
        ->line(-$midPoint, -$size)
        ->curve(-$midPoint, -$size, -$size, -$size, -$size, -$midPoint)
        ->line(-$size, 0)
        ->line(-$size, $midPoint)
        ->curve(-$size, $midPoint, -$size, $size, -$midPoint, $size)
        ->line(0, $size)
        ->close();
    

    Here the result:
    test

  3. wojoj93 commented on May 29, 2023

    @wojoj93

    Could someone explain to me why using this code I get very poor quality rounding?
    Zaznaczenie_1204

  4. Rizwansayyed786 commented on Sep 9, 2023

    @Rizwansayyed786

    how can I use this to work in mine I would want to build the same QR code. I am using Laravel?

    this is my current generated qr code using simple qr code
    fonp-qr

  5. locked and limited conversation to collaborators on Mar 19, 2024
  6. converted this issue into a discussion #165 on Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions