Documentation ¶
Overview ¶
Package types provides data structures and functions for handling GitHub contribution data and 3D geometry for STL file generation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContributionDay ¶
ContributionDay represents a single day of GitHub contributions. It contains the number of contributions made on a specific date.
func (ContributionDay) IsAfter ¶
func (c ContributionDay) IsAfter(t time.Time) bool
IsAfter checks if the contribution day is after the given time
func (ContributionDay) Validate ¶
func (c ContributionDay) Validate() error
Validate checks if the ContributionDay has valid data. Returns an error if the date is not in the correct format or if the contribution count is negative.
type ContributionsResponse ¶
type ContributionsResponse struct { Data struct { User struct { Login string ContributionsCollection struct { ContributionCalendar struct { TotalContributions int `json:"totalContributions"` Weeks []struct { ContributionDays []ContributionDay `json:"contributionDays"` } `json:"weeks"` } `json:"contributionCalendar"` } `json:"contributionsCollection"` } `json:"user"` } `json:"data"` }
ContributionsResponse represents the GitHub GraphQL API response structure for fetching user contributions data.
type Point3D ¶
type Point3D struct {
X, Y, Z float64
}
Point3D represents a point in 3D space using float64 for accuracy in calculations. Each coordinate (X, Y, Z) represents a position in 3D space.
func (Point3D) ToFloat32 ¶
func (p Point3D) ToFloat32() Point3DFloat32
ToFloat32 converts a Point3D to Point3DFloat32. The conversion from float64 to float32 is necessary for STL file format compatibility, as the STL binary format specifically requires 32-bit floating-point numbers. While calculations are done in float64 for better precision, the final output must conform to the STL specification.
type Point3DFloat32 ¶
type Point3DFloat32 struct {
X, Y, Z float32
}
Point3DFloat32 represents a point in 3D space using float32 for STL output. This type is specifically used for STL file format compatibility.
type Triangle ¶
Triangle represents a triangle in 3D space using float64 coordinates. It consists of a normal vector and three vertices defining the triangle.
func (Triangle) ToFloat32 ¶
func (t Triangle) ToFloat32() TriangleFloat32
ToFloat32 converts a Triangle to TriangleFloat32. This conversion is required for STL file format compliance, which mandates the use of 32-bit floating-point numbers. While internal calculations use float64 for improved accuracy, the final STL output must use float32 values to maintain compatibility with CAD and 3D printing software.
type TriangleFloat32 ¶
type TriangleFloat32 struct { Normal Point3DFloat32 V1, V2, V3 Point3DFloat32 }
TriangleFloat32 represents a triangle with float32 coordinates for STL output. This type is specifically used for STL file format compatibility.