Pages

Showing posts with label Fedora 14. Show all posts
Showing posts with label Fedora 14. Show all posts

Wednesday, November 20, 2024

Fedora 41 : generated shapes with python !

Today I created this source code in python that generates eight random convex polygons. The idea was to create sprites for a 2D game: snowballs, boulders, or similar objects ... Obviously I also used Sonet 3.5 artificial intelligence. You can find the source code on the pagure account in fedora.
#!/usr/bin/env python3
"""
SVG Polygon Generator

This script generates multiple deformed polygonal shapes and saves them as separate SVG files.
Each polygon maintains convex properties while having controlled random deformations.

Features:
    - Generates 8 unique polygonal shapes
    - Controls deformation through radial and angular factors
    - Maintains convex properties
    - Exports each shape to a separate SVG file
    - Uses random colors for visual distinction

Usage:
    python generate_svgs.py

Output:
    Creates 8 SVG files named 'polygon_1.svg' through 'polygon_8.svg'
"""

from lxml import etree
import random
import math
from pathlib import Path


def create_svg_root():
    """Create and return a base SVG root element with standard attributes."""
    root = etree.Element("svg")
    root.set("width", "500")
    root.set("height", "500")
    root.set("xmlns", "http://www.w3.org/2000/svg")
    return root


def calculate_points(center_x: float, center_y: float, radius: float, 
                    num_sides: int, deform_factor: float) -> list:
    """
    Calculate polygon points with controlled deformation.

    Args:
        center_x: X coordinate of polygon center
        center_y: Y coordinate of polygon center
        radius: Base radius of the polygon
        num_sides: Number of polygon sides
        deform_factor: Maximum allowed deformation factor

    Returns:
        List of tuples containing (x, y) coordinates
    """
    points = []
    angle_step = 2 * math.pi / num_sides
    
    for i in range(num_sides):
        angle = i * angle_step
        radial_deform = random.uniform(-deform_factor, deform_factor)
        angular_deform = random.uniform(-deform_factor/2, deform_factor/2)
        
        modified_angle = angle + angular_deform
        modified_radius = radius * (1 + radial_deform)
        
        x = center_x + modified_radius * math.cos(modified_angle)
        y = center_y + modified_radius * math.sin(modified_angle)
        points.append((x, y))
    
    return points


def generate_deformed_shapes():
    """Generate multiple deformed polygons and save them to separate SVG files."""
    # Base parameters
    num_sides = 8
    center_x = 250
    center_y = 250
    base_radius = 150
    max_deformation = 0.15
    output_dir = Path("generated_polygons")
    
    # Create output directory if it doesn't exist
    output_dir.mkdir(exist_ok=True)

    for i in range(8):
        root = create_svg_root()
        points = calculate_points(center_x, center_y, base_radius, 
                                num_sides, max_deformation)
        
        path = etree.SubElement(root, "path")
        path_data = f"M {points[0][0]} {points[0][1]}"
        path_data += "".join(f" L {p[0]} {p[1]}" for p in points[1:])
        path_data += " Z"
        
        path.set("d", path_data)
        path.set("fill", "none")
        path.set("stroke", f"#{random.randint(0, 16777215):06X}")
        path.set("stroke-width", "2")
        path.set("opacity", "0.7")

        # Save individual SVG file
        output_file = output_dir / f"polygon_{i+1}.svg"
        tree = etree.ElementTree(root)
        tree.write(str(output_file), pretty_print=True, 
                  xml_declaration=True, encoding='utf-8')
    
    print(f"Generated {num_sides} polygons in {output_dir}")

if __name__ == "__main__":
    generate_deformed_shapes()

Sunday, December 12, 2010

Blender 3D and F14 killed by "Save as"

Although he reached the 2.55 beta, Fedora 14 is still struggling with version 2.49b.
Not bad if it goes, but here's one little problem
It's all well and good until the "Save as".
Then it breaks and you have just this reason:
Process /usr/bin/blender.bin was killed by signal 6 (SIGABRT)

Thursday, December 9, 2010

gDEBugger - FREE or NOT ?

A very popular OpenGL debugger is now available for FREE?
On official site we saw:
Order
gDEBugger is not available for purchasing for the time being.
We plan to release a new and **FREE** gDEBugger version for Windows, Linux and Mac OS X. This version will be available for download by the end of 2010.
Please make sure to check our website for this version in the near future.
Until the free version will be released, please find below a temporary license file that will enable you to use the current gDEBugger version for free immediately.

Now is the end of 2010, but is not free.
What is gDEBugger
Named gDEBugger is an advanced OpenGL Debugger, Profiler and Graphic Memory Analyzer.
This 3D software saves you debugging time and helps you boost application performance.
We can download it from :here.
I searched my computer the lib libstdc++, see below :
# yum search libstdc++
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
============================== Matched: libstdc++ ==============================
compat-libstdc++-296.i686 : Compatibility 2.96-RH standard C++ libraries
compat-libstdc++-33.i686 : Compatibility standard C++ libraries
libstdc++.i686 : GNU Standard C++ Library
libstdc++-devel.i686 : Header files and libraries for C++ development
libstdc++-docs.i686 : Documentation for the GNU standard C++ library
libstdc++-static.i686 : Static libraries for the GNU standard C++ library
The archive named gDEBugger57-i386-cpp3.tar.gz has 13Mb.
Then I use commands :

$gzip -dc gDEBugger57-i386-cpp3.tar.gz | tar xf -
$ cd gDEBugger57-i386-cpp3
$ su 
# yum install compat-libstdc++-33.i686 
The gDEBugger run well under fedora 14 , but is free only 7 days. See below:

Wednesday, December 8, 2010

Fakeroot and Yum

It seems that the yum and fakeroot do not get along too well.
I did not understand why ... Here is output:
yum search aaa
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Cannot open logfile /var/log/yum.log
Could not create lock at /var/run/yum.pid: [Errno 13] Permission denied: '/var/run/yum.pid'
Another app is currently holding the yum lock; waiting for it to exit...
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 258, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 104, in main
    show_lock_owner(e.pid, logger)
  File "/usr/share/yum-cli/utils.py", line 107, in show_lock_owner
    ps = get_process_info(pid)
  File "/usr/share/yum-cli/utils.py", line 62, in get_process_info
    if (not os.path.exists("/proc/%d/status" % pid) or
TypeError: %d format: a number is required, not str
 

And I have nothing on, like rpm, yum or gpk-prefs...

Sunday, December 5, 2010

Fedora 14 and NVIDIA FX5200

Today I set video driver on Fedora 14.
I have an FX5200 and I use akmod to make this working.
First when I install akmod with :
yum install kmod-nvidia-173xx-2.6.35.6-48.fc14.i686.PAE.i686
I have some errors:
$ glxinfo | grep direct
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Error: couldn't find RGB GLX visual or fbconfig
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
But i solve and Savage XR working well :

Thursday, December 2, 2010

Fedora 14 versus 3D software .

In the next few days ago I decided to try software 3d with Fedora 14.
I am disappointed again. I was expecting some improvements in this area by the developers.
Especially because it is a difficult topic.
But let's see why I have this impression...
I have searched for packages that are required with this command:
# yum search "3d engine"
...
============================== Matched: 3d engine ==============================
irrlicht.i686 : A high performance realtime 3D engine
crystalspace.i686 : Crystal Space a free 3D engine
ember.i686 : 3D client for WorldForge
ogre.i686 : Object-Oriented Graphics Rendering Engine
Code:: Blocks does not work with Ogre 3D or Irrlicht 3D packages. Although I spent quite a long time. However, on Windows XP this combination worked well.
Ember game working hard. Maybe because my video card - FX5200, not really likes the new drivers.
Code:: Blocks is very stubborn. Ogre and Irrlicht Wizards of the Linux version of Code:: Blocks does not work at all.

Thursday, November 25, 2010

Fun with F-Spot 0.8.0 and sqlite3

Today I focused on the F-Spot version 0.8.0.
I knew that contains a database that keeps information about the pictures.
I found the database and tried a few commands:
$ cd .config/
$ cd f-spot/
$ ls
addin-db-001  photos.db
Once I found the database, I started SQLite3. See the example below:
$ sqlite3  photos.db 
SQLite version 3.7.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
exports         meta            photo_versions  rolls         
jobs            photo_tags      photos          tags          
sqlite> .schema photos
CREATE TABLE photos (
 id   INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
 time   INTEGER NOT NULL, 
 base_uri  STRING NOT NULL, 
 filename  STRING NOT NULL, 
 description  TEXT NOT NULL, 
 roll_id   INTEGER NOT NULL, 
 default_version_id INTEGER NOT NULL, 
 rating   INTEGER NULL 
);
CREATE INDEX idx_photos_roll_id ON photos(roll_id);
sqlite> select * from photos;
1|1279913277|file:///home/mythcat/Photos/2010/07/23|IMG_2970.JPG||1|1|0
It is easy to use and implemented various python scripts.

Thursday, November 11, 2010

Notifications in Fedora 14

We use the following command
$ notify-send  "This is some text"
or
$zenity --info --text "This is some text"
This will display a text balloon "This is some text".
The problem appears when we want to display the output of a command.
For this, I used a python script. Here's the source code:
#!/usr/bin/env python
import os
import sys
import pynotify
pynotify.init("Output comand")
arg=sys.argv[1]
print arg
s = os.popen(arg).read()
n = pynotify.Notification("Output",s)
n.show()
If you wish to use a compound command, then you will need to use quotes.
For example, we use the command "ls-a 'as follows:
$python testpy.py "ls -a"
This is just a small example, you can create more complex applications.

Saturday, November 6, 2010

How Install Firefox 4 on Fedora 14.

Firefox is one of the latest versions of the Mozilla .

It is currently available in two repositories - Remi and Spot.

See the next steps if you want install Firefox 4.

First , go on super user shell.

# wget http://repos.fedorapeople.org/repos/spot/firefox4/fedora-firefox4.repo -O /etc/yum.repos.d/fedora-firefox4.repo

Now, you can install Firefox 4

# yum --enablerepo fedora-firefox4 install firefox4

That is all.

Fedora 14 and Blender 3D

It is a great disappointment to me that Fedora 14 comes with Blender 3D version 2.49b-10.
I expected a pleasant surprise to see version 2.5.
Here is the result:

# yum search blender
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
updates/pkgtags                                                   |  10 kB     00:00     
============= Matched: blender =====================
blenderplayer.i686 : Standalone blender player
LuxRender-blender.i686 : Blender export plugin to LuxRender
blender.i686 : 3D modeling, animation, rendering and post-production
spe.noarch : Python IDE with UML,PyChecker,Debugger,GUI design,Blender & more
libpano13-tools.i686 : Tools that use the libpano13 library
yofrankie-bge.noarch : 3D Game with characters from Big Buck Bunny movie
Of course, you can use version 2.5 from the official site.