C# :: Image Rotation Leaves Null Areas
Jan 29, 2015
I am working on a Paint program and I have a nice routine (copied from the Net) that beautifully rotates my Image by any chosen degree, and even preserving the entire Image with a 'noclipping' option.
The problem is - That after the rotation, say 45degrees, the areas in the corners, that originally were not part of the Image, cannot be drawn to. I have an 'eye dropper tool' that shows these areas to be null, having no color. My drawing tools will not work on these areas.
public static Bitmap RotateImage(Image image, float rotateAtX, float rotateAtY, float angle, bool bNoClip) {
int W, H, X, Y;
if (bNoClip) // use Clipping {
double dW = (double)image.Width;
double dH = (double)image.Height;
double degrees = Math.Abs(angle);
[Code] ....
View 13 Replies
ADVERTISEMENT
Nov 4, 2014
I am new to image processing..... and I am learning the concepts.
Recently I have done image rotation of grey scale image using the following formula:
x' = xcos(theta)-ysin(theta)
y' = xsin(theta)+ycos(theta)
The problem i have faced is image is getting cropped.
I want to rotate an image without cropping. I have searched a lot but I am not getting any algorithm based on C. How to get the algorithm for image rotation without cropping.
View 2 Replies
View Related
Mar 19, 2014
So i am struggling for days to get this done and all i need is to get the sum of the areas and get them printed on the screen my code is this:
Code:
#include<stdio.h>
#include <stdlib.h>
#include<conio.h> //Not needed in Dev C++//
#define PI 3.1415
float Area_of_Rectangular(float length,float width);
float Area_of_Circle(float radius);
int main()
[Code]...
View 7 Replies
View Related
Jun 2, 2013
Draw a binary tree having 4 nodes and 3 leaves ...
View 4 Replies
View Related
May 9, 2012
I can't run my server immediately after closing it, it leaves some connection(zombies) leave open after the server is terminated. and i have to wait for some time to run the server again but immediately can't start the server
Here is my code
#include "NetManager.h"
NetManager::NetManager(){
}
NetManager::~NetManager() {
[Code] ....
View 10 Replies
View Related
Apr 17, 2014
My application calls malloc in multiple subroutines, finally releasing all using free. This is done using my zalloc library (see my other post: [URL] .....
Somehow, when the applications tries to detect the available ammount of memory at the end of the test (allocating, freeing, testing), the freemem function gives me about 4-6MB less memory than at the start of the test? (out of 21MB available on the device at the start).
All memory is allocated and freed using the malloc/free routines within the library, with the exception of the SDL functions, which are registered externally on allocation and release.
View 3 Replies
View Related
Feb 18, 2014
I am looking at one of the functions of an exercise:
void escape(char * s, char * t) {
int i, j;
i = j = 0;
while ( t[i] ) {
/* Translate the special character, if we have one */
switch( t[i] ) {
[code]...
Notice the while loop evaluates the current value in t to true or false. When we hit the null terminator, does that get evaluated as 0 and hence evaluates as a falsy value so the while loop exits?
View 1 Replies
View Related
Feb 7, 2013
I am creating and implementing a left and a right rotation to balance a bst into an avl tree. I have made and tried 5 different codes that are commented in the functions left_rotate() and right_rotate() but none have run correctly. Sometimes the program works, sometimes there is a segmentation fault and sometimes not all inserted numbers are shown.
avl.c
Code:
#include<stdio.h>#include<stdlib.h>
#include<time.h>
#include "avl.h"
#define N 10
void swap(int *a, int *b){
[Code] ....
View 1 Replies
View Related
Mar 31, 2015
When you login to my site my loginservice which is done by ajax and json make a session called context.Session["Name"]. With BreakPoints it shows that everything is good and the variables are in place. However when I use Session["Name"] it comes out as null.
I will add my code at the bottem not
using System;
using System.Collections.Generic;
using System.Linq;
[Code].....
View 2 Replies
View Related
Jun 10, 2014
Just bought a new ST Micro iNEMO-M1 system, and am looking to have my code visually show me the rotation information. I've got a working C++ code which actively acquires data from the sensor, and I'm looking to extend that into some visual interface which will show me on-screen the position of the sensor.
I figure using rotation information in the form of quaternion data is the most useful (want to avoid the gimbal lock problems associated with Roll/Pitch/Yaw).
What would be the best method to visualize the rotation of my sensor in real-time?
View 2 Replies
View Related
Aug 16, 2012
I have a 3d Point in space. From this point I have vertices defind by(scale). I have a Quaternion representing the rotation of the object (lets say a block). So...
(1) I know the point in local and world space and can translate.
(2) I know the scale of the object and it's starting vertices intersections at zero rotation.
(3) I have the quaternion which represents the 3d rotation and can translate that to degrees and Eulers.
How do i find the exact points of the vertices after the rotation. (what I'm attempting to do is plot points from vertice to vertice all along the sides/top/bottom of the object.)I have looked at Matrix4 transformations and Quaternions and still do not understand how to find the vertices after rotation.
View 8 Replies
View Related
Jan 13, 2015
how I want my sprite movement to work: if my sprite is faced upwards and i press W, it will move up. If my sprite is faced to the right and i press W, it will go right. etc. // It doesn't work like that right now and how to do it.The sprite's rotation works fine.
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Q)) {
playerSprite.rotate(-0.08 * dt);
} else if(sf::Keyboard::isKeyPressed(sf::Keyboard::E)) {
playerSprite.rotate(0.08 * dt);
[code]....
My question is how do I move the character depending on the rotation?
Also, you might see the "if(havePlayersCollided == false) {playerSprite.move(yadiyada)}" . yes i dont need the haveplayerscollided function because it doesnt work the way I want it to. I might make a thread for it in the future, but right now I need to get the rotation movement fixed before I move onto the collision detection between players.
View 7 Replies
View Related
Dec 31, 2014
I'm trying to get a rotation of a spefic point in a 3D space using 3 or 4 coordinate/vector.
For example, I want to know the rotation of (5,5,5)
Using 4 vectors for example (0,0,0), (10,10,10), or 10,0,10, etc. (3 minimum)
View 2 Replies
View Related
Mar 4, 2014
It is technically not a programming question and is more maths oriented. It has to do with game AI and specifically getting the AI to rotate correctly. I am trying to create the base method that handles AI rotation. It will take a target orientation and rotate the entity from it's current orientation to that target orientation.
Let's say we have a Entity that has the orientation of 1.57079 Radians (90 Degrees) and we want to change that Entity's orientation to 0 Radians (0 Degrees). How would one find the correct way to rotate from just them two orientations (IE find the shortest rotation direction from a current orientation to a target orientation)?
As my implementation stands now the Entity rotates just fine I think but always in a clockwise rotation (Because I can't figure out how to determine the best rotation direction). For example using the previous number (1.57079 Radians to 0 Radians) the Entity will rotate all the way around 270 Degrees clockwise instead of rotating just 90 degrees counter-clockwise.
I have thought about possibly projecting vectors a short distance forward from the current orientation and target orientation to figure out the rotation direction but not sure if that is a good way to implement it.
View 1 Replies
View Related
Apr 27, 2013
I am doing a project for a class which involves making a game where there is an arrray that holds a player (you) and a zombie (comp). The player is suppose to be able to turn clockwise or counter clockwise, move forward, and backward and shoot. Im having trouble trying to rotate the char in an array. I am also trying to switch from using the W,S,D,A to the arrow keys but doesnt seem to work.
#include <iostream>
#include <windows.h>
#include "color.h"
using namespace std;
using namespace Petter;
const int COL = 15;
void initBoard(char[][COL], int, int);
[Code] ....
View 5 Replies
View Related
Jul 3, 2014
Im trying to compare the image of a button to another image in Visual Studio like so...
//variables
Image active = Image.FromFile("C:\Users\Ethan\Desktop\StarWars Status\active.png");
Image stunned = Image.FromFile("C:\Users\Ethan\Desktop\StarWars Status\stunned.png");
[Code]...
btnStatusPlr1.Image SHOULD come back as True.Then I realized it might not be the same as setting the buttons image in the properties (Which is what i did to get the original image (the one being compared to))
I do have a feeling ive done something wrong here (Yes im a noob /> )
Variable active, is the same image as the buttons default (Well should be)
View 1 Replies
View Related
Sep 25, 2013
I m developing an application using kinect.The IDE I use is Visual studio 2012 and kinect SDK 1.8.I m developing using vc++
I want to overlay an image on the person tracked when the person turns 180 degress to kinect. ie the person is not facing the kinect.
how do i track the rotation angle of the person as he/she turns away from kinect.
View 7 Replies
View Related
Dec 7, 2014
which asking to make a rotation to a 2d array without using any other array , so here's an example :
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
i want to add 90 degree so :
13 9 5 1
14 10 6 2
15 11 7 3
16 12 8 4
View 2 Replies
View Related
Oct 15, 2014
For some reason I keep getting null pointers in most of my functions, and in my convertTime function the numbers are way higher than they should be.
Code:
//Utils.H header file----------------------------------------------
//This function takes the radius of a circle and returns the diameter, the circumference and the area.
int circleStatistics(double radius, double *diameter, double *circumference, double *area);
//This function takes a number of days and returns how many years, weeks and remaining days that is.
int convertTime(int days, int *y, int *w, int *d);
//This function takes a length of time and calculates the dilation of that time at a percentage of the speed of light.
int lorentzTimeDilation(double normalTime, double percentC, double *dilatedTime);
[Code] ....
View 3 Replies
View Related
Apr 13, 2014
Is:
char *endp = NULL;
the same thing as:
char *endp = 0;
?
View 1 Replies
View Related
Jul 23, 2013
I am beginner in C++ programming. And i was try use STRTOK code with NULL fields, but in ARRAY fields NULL values is skiped. For example:
input text in Memo2:
AnsiString PAT02[100][20];
for (int IndexVRadku02 = 0; IndexVRadku02 < Memo2->Lines->Count ; IndexVRadku02++) {
AnsiString PNF02 = Memo2->Lines->Strings[IndexVRadku02];
char * PN02;
[Code] ....
Result:
Array 00 01 02 03 04 05
00 0000 TEXT1 TEXT2
01 0002 TEXT3 TEXT4 TEXT5
02 0003 TEXT6
But i need this result:
Array 00 01 02 03 04 05
00 0000 TEXT1 TEXT2
01 0002 TEXT3 TEXT4 TEXT5
02 0003 TEXT6
View 2 Replies
View Related
Jul 9, 2014
I dont see any point of NULL in cstring. The code given below just outputs same as it would have done with NULL. My understanding is if size of char array is less than length of char array then null must be manually added?
#include <iostream>
using namespace std;
int main(){
char chr[0];
cin>>chr;//or if you use cin.getline;
cout<<chr<<endl;
return 0;
}
Enter something: hellowwwww
hellowwwww
Segmentation fault (core dumped)
why? for NULL char or something else?
View 1 Replies
View Related
Apr 9, 2014
In my raytracer-project I have the following function:
bool hitObjects(Ray &ray, std::vector<Object *> &objects, Vector3& normal, Material *mat) {
double tmin = K_HUGE_VALUE;
double t;
[Code]....
When I try to run this, I only get the message "Material pointer is null". So, somehow the pointer is null after the hitObjects-function is called, even though it isn't inside that function.
View 6 Replies
View Related
Jul 30, 2014
The resultset is always null and the connection is alive. The VS2013 debugger says that mysqlcppconn.dll has no debugging symbols. Tested the query on a mysql console and it worked fine, it returned 1.
CDatabase::CDatabase(CSettings* settings) {
settings = settings;
try {
Connection* con = get_driver_instance()->connect("", "", "");
con->setSchema("hyperbot");
cout << "Connected." << endl << endl;
[Code] .....
I also get these strange warnings on compile:
1>c:program files (x86)mysqlmysql connector c++ 1.1.3includecppconnsqlstring.h(38):
warning C4251: 'sql::SQLString::realStr' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
needs to have dll-interface to be used by clients of class 'sql::SQLString'
[Code] ......
View 10 Replies
View Related
Mar 1, 2015
I'm playing around with parts of code and am coming across some errors. Most of my concern is related to strtok(). I've used it before but with a char* named token. I used a while loop to continuously check whether token was equal to NULL. In the following code, however, there aren't any checks. I was wondering if that is why this code prints (null) while running. Also, I would like to know if it is possible to read input like this code attempts to do - assigning tokens to each variable one after the other.
The format of the input:
Zucchini, Squash, pound
Yellow, Squash, pound
Tomatoes, Ugly Ripe, each
#include <stdio.h>
#include <stdlib.h>
[code]....
View 3 Replies
View Related
May 17, 2014
So I'm writing a small program for class, and for some reason I keep getting an error when trying to initialize head to NULL. Even threw in the namespace just to see, nothin'.
#ifndef NUMBERLIST_H
#define NUMBERLIST_H
using namespace std;
[Code].....
There's my header file. Not sure what I'm doing wrong with the constructor.
EDIT: Got it to work with nullptr, but still curious why that isn't working
View 2 Replies
View Related