Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[MNT]: Hatch density being int or float? #26645

Open
@oscargus

Description

@oscargus

Summary

The typing makes it clear that both are used.

density ofPath.hatch is typed asfloat. This is then passed tohatch.get_path, where it is typed asint and then does:

density=int(density)
patterns= [hatch_type(hatchpattern,density)
forhatch_typein_hatch_types]

hatch_type is one of the hatch methods and typically has a line like:

self.num_lines=int((hatch.count('-')+hatch.count('+'))*density)

As seen it is possible to pass a float until here.

Proposed fix

I see two solutions:

  1. Typedensity ofPath.hatch asint. This makes it consistent and there are no consequences.
  2. Typedensity elsewhere asfloat and remove theint(density) inget_path. This will work properly from a typing pespective, but change the appearance. For example, usingPath.hatch("/xX/xX", 1.9) will changenum_lines ofNorthEastHatch from6*int(1.9) = 6 toint(6*1.9) = 11. However, it will also allow a more detailed control of the density in a more natural way.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp