Calculating Position of Rectangle Corners

Hello again everyone - I'm in the middle of attempting to write my own collision detection algorithm because the built in 'hitTestObject' function seems to be incredibly inaccurate (it's registering 'hits' when the objects are still a considerable distance from each other).
I need to be able to calculate the position of each of the 4 corners of a rectangle, based on its rotation. Obviously one of the corners will simply be the rectangle's x and y coordinates. I have made a little test program to make sure I am calculating the positions of the corners accurately - it works when the rectangle is rotated to 0, 90, 180 and 270 degrees, but produces strange results for any other angles...
I have attached the program at the bottom, but here is the code:
package
    import flash.display.MovieClip;
    import flash.geom.Point;
    public class CornerFinder extends MovieClip
        //vars
        var myRect:MovieClip;
        //constructor
        public function CornerFinder():void
            myRect = new MyRectangle();
            myRect.x = stage.stageWidth/2;
            myRect.y = stage.stageHeight/2;
            myRect.rotationZ = 270;
            addChild(myRect);
            AddCornerMarkers();
        private function AddCornerMarkers():void
            //The rotation of the rectangle in radians
            var rectRotation = myRect.rotationZ*(Math.PI/180);
            var corners:Array = new Array();
            corners[0] = new Point(myRect.x, myRect.y);
            corners[1] = new Point( (myRect.x + myRect.width * Math.cos(-rectRotation)), (myRect.y + myRect.height*Math.sin((rectRotation) )) );
            corners[2] = new Point( (myRect.x + myRect.width * Math.sin(-rectRotation)), (myRect.y + myRect.height*Math.cos((rectRotation) )) );
            corners[3] = new Point(corners[2].x + (corners[1].x - corners[0].x) , corners[2].y + (corners[1].y - corners[0].y));
            for(var i:uint = 0; i < corners.length; i++)
                var marker:MovieClip = new CornerMarker();
                marker.x = corners[i].x - marker.width/2;
                marker.y = corners[i].y - marker.height/2;
                trace("Adding marker at: " + marker.x + ", " + marker.y);
                addChild(marker);
MyRectangle, as you may have guessed is a simple rectangular symbol that is in the library of my fla file. The CornerMarker is just a red circle symbol.
Can anyone see what the problem is? I thought if it worked for the 'main' angles (e.g. 0, 90, 180, etc) it would work for everything in between, but apparently not...

you misunderstand.
try:
package
    import flash.display.MovieClip;
    import flash.geom.Point;
    public class CornerFinder extends MovieClip
        //vars
        var myRect:MovieClip;
        //constructor
        public function CornerFinder():void
            myRect = new MyRectangle();
            myRect.x = stage.stageWidth/2;
            myRect.y = stage.stageHeight/2;
            myRect.rotationZ = 270;
            addChild(myRect);
            AddCornerMarkers();
        private function AddCornerMarkers():void
            //The rotation of the rectangle in radians
            var rectRotation = myRect.rotationZ*(Math.PI/180);
            var corners:Array = new Array();
myRect.rotationZ=0;
            corners[0] = new Point(myRect.x, myRect.y);
corners[1] = new Point( (myRect.x + myRect.width *
Math.cos(rectRotation)), (myRect.y +
myRect.width*Math.sin((rectRotation) )) );
           // corners[2] = new Point( (myRect.x + myRect.width * Math.sin(-rectRotation)), (myRect.y + myRect.height*Math.cos((rectRotation) )) );
          //  corners[3] = new Point(corners[2].x + (corners[1].x - corners[0].x) , corners[2].y + (corners[1].y - corners[0].y));
myRect.rotationZ=rectRotation*180/Math.PI;
            for(var i:uint = 0; i < corners.length; i++)
                var marker:MovieClip = new CornerMarker();
                marker.x = corners[i].x - marker.width/2;
                marker.y = corners[i].y - marker.height/2;
                trace("Adding marker at: " + marker.x + ", " + marker.y);
                addChild(marker);

Similar Messages

  • Rounded rectangle corners in FW3?

    Where the heck is my rectangle tool options panel that let's
    me round rectangle edges?!?!?!
    you may ask, why version 3? - it's 'cuz my company is too
    cheap to upgrade. I use it decently well despite this, but I
    digress.
    I thought all you had to do was double click the rectangle
    tool like it states in the help:
    You can round the corners of a rectangle or square as you
    draw it by setting the curvature of the corners in the Rectangle
    tool Options panel.
    Set this value before drawing the rectangle.
    To draw a rectangle with rounded corners:
    1 Double-click the Rectangle tool to open the Rectangle tool
    Options panel.
    2 Enter a value in the Corner text box.
    3 Hold down the mouse button and drag to draw a rectangle.
    Note: You cannot round the corners of an existing rectangle.
    The problem is, that the Rectangle tool options panel doesn't
    open!! is this a bug? or am i just missing something really
    obvious?? help!! has anyone else run into this?

    oy vey. never mind - i found it. it's so obvious that i want
    to cry. the problem was the inspector was already open and off
    underneath something that I couldn't immediately see. what a
    doofus. sorry for taking up space.

  • How can I do calculation positioning in crosstab?

    I have a calculation that should be displayed in only one column, at the right of a crosstab. Discoverer insists to copy my calculation under all columns, repeating the same result under each.
    Is their a way to fix it at one place?

    this is an example of how you can accomplish this with Region along the x-axis.
    You need to do the same thing with the ages to get age along the x-axis.
    I'm not sure it is an ideal solution given the large range of ages.
    For each region, create a calculation as follows:
    Calculation named 'Region A'
    SUM(DECODE(Region,'Region A',[person count])
    Calculation named 'Region B'
    SUM(DECODE(Region,'Region B',[person count])
    Calculation named 'Region Z'
    SUM(DECODE(Region,'Region Z',[person count])
    Then a final calculation, to get the percentage:
    Calculation named 'All regions'
    something like
    (SUM([person count]) OVER (Parition by AGE])) / SUM[person_count]
    which will divide the [person count] for that row (age) by the total [person count].
    To get Age along the x-axis you need to create a calculation for each age, and the final calculation will be
    (SUM([person count]) OVER (Parition by Region])) / SUM[person_count]

  • Bitmap Rotation According to Mouse Position?

    Hi,
    I am working on a 2d computer graphics project, and I need a good function to rotate a Bitmap 360 degree according to my mouse position.
    for example: 

    Hi,
    I am working on a 2d computer graphics project, and I need a good function to rotate a Bitmap 360 degree according to my mouse position.
    for example: 
    Hello,
    To rotate that image, we need to deal with the following tips.
    1. The image size.
    If the area for that image rotated is not big enough, it will just lose some parts of that image.
    Here is a nice code shared in this thread
    http://stackoverflow.com/questions/5199205/how-do-i-rotate-image-then-move-to-the-top-left-0-0-without-cutting-off-the-imag/5200280#5200280.
    private Bitmap RotateImage(Bitmap b, float Angle)
    // The original bitmap needs to be drawn onto a new bitmap which will probably be bigger
    // because the corners of the original will move outside the original rectangle.
    // An easy way (OK slightly 'brute force') is to calculate the new bounding box is to calculate the positions of the
    // corners after rotation and get the difference between the maximum and minimum x and y coordinates.
    float wOver2 = b.Width / 2.0f;
    float hOver2 = b.Height / 2.0f;
    float radians = -(float)(Angle / 180.0 * Math.PI);
    // Get the coordinates of the corners, taking the origin to be the centre of the bitmap.
    PointF[] corners = new PointF[]{
    new PointF(-wOver2, -hOver2),
    new PointF(+wOver2, -hOver2),
    new PointF(+wOver2, +hOver2),
    new PointF(-wOver2, +hOver2)
    for (int i = 0; i < 4; i++)
    PointF p = corners[i];
    PointF newP = new PointF((float)(p.X * Math.Cos(radians) - p.Y * Math.Sin(radians)), (float)(p.X * Math.Sin(radians) + p.Y * Math.Cos(radians)));
    corners[i] = newP;
    // Find the min and max x and y coordinates.
    float minX = corners[0].X;
    float maxX = minX;
    float minY = corners[0].Y;
    float maxY = minY;
    for (int i = 1; i < 4; i++)
    PointF p = corners[i];
    minX = Math.Min(minX, p.X);
    maxX = Math.Max(maxX, p.X);
    minY = Math.Min(minY, p.Y);
    maxY = Math.Max(maxY, p.Y);
    // Get the size of the new bitmap.
    SizeF newSize = new SizeF(maxX - minX, maxY - minY);
    // ...and create it.
    Bitmap returnBitmap = new Bitmap((int)Math.Ceiling(newSize.Width), (int)Math.Ceiling(newSize.Height));
    // Now draw the old bitmap on it.
    using (Graphics g = Graphics.FromImage(returnBitmap))
    g.TranslateTransform(newSize.Width / 2.0f, newSize.Height / 2.0f);
    g.RotateTransform(Angle);
    g.TranslateTransform(-b.Width / 2.0f, -b.Height / 2.0f);
    g.DrawImage(b, 0, 0);
    return returnBitmap;
    2. The location of that control which displays that image.
    If we use a picturebox, and set its sizemode to autosize like the following line, then if you just want to rotate that image to show, and you don't want to that affects the original image, then we need to keep its center point.
    this.pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
    We could add resize event handler after we set image for that picturebox.
            Point pOrign;
            Size sOrign;private void Form1_Load(object sender, EventArgs e)
    this.pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
    Image img = Image.FromFile(@"D:\Documents\New folder\New folder\TestImage.PNG");
    this.pictureBox1.Image = img;
    this.pictureBox1.InitialImage = img;
    pOrign = new Point(this.pictureBox1.Left , this.pictureBox1.Top );
    sOrign = new Size(this.pictureBox1.Width, this.pictureBox1.Height);
    this.pictureBox1.BorderStyle = BorderStyle.FixedSingle;
    this.pictureBox1.Resize += pictureBox1_Resize;
    private void pictureBox1_Resize(object sender, EventArgs e)
    this.pictureBox1.Left = this.pOrign.X + (this.sOrign.Width - this.pictureBox1.Width) / 2;
    this.pictureBox1.Top = this.pOrign.Y + (this.sOrign.Height - this.pictureBox1.Height) / 2;
    3. The angle between that center point and your mouse postion.
    We could get that value inside the picturebox's container's mouse_move event.
    Double angleNew ; private void pictureBoxContainer_MouseMove(object sender, MouseEventArgs e)
    angleNew = Math.Atan2(this.pOrign.Y + this.sOrign.Height / 2 - e.Y, this.pOrign.X + this.sOrign.Width/2 - e.X) * 180.0 / Math.PI;
    But when to start rotate that image, it should be your chooice, and you could decide when rotate that image with the following line.
    this.pictureBox1.Image = (Image)RotateImage(new Bitmap(this.pictureBox1.InitialImage), (float)angleNew);
    If you just want to save that change to that image, then you could save that bitmap to file directly.
    Happy new year.
    Regards.
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Error with cursor position on Chart

    Hello
    I'm getting an error with a simple Chart.  I'm trying to show the chart position (using labels and a crosshair) and I'm getting an exception ONLY (it seems) when the program starts up with the cursor above the chart.  If I move the cursor off to
    the side or something I don't get the error.
    Error: PositionToValue method cannot be called prior to calculating position of all chart area elements.
    The error occurs in the MouseMove event handler.
    private void crtPlotData_MouseMove(object sender, MouseEventArgs e)
    Point mousePoint = new Point(e.X, e.Y);
    crtPlotData.ChartAreas[0].CursorX.Interval = 0;
    crtPlotData.ChartAreas[0].CursorY.Interval = 0;
    crtPlotData.ChartAreas[0].CursorX.SetCursorPixelPosition(mousePoint, true);
    crtPlotData.ChartAreas[0].CursorY.SetCursorPixelPosition(mousePoint, true);
    lblXposition.Text = "Pixel X Position: " + crtPlotData.ChartAreas[0].AxisX.PixelPositionToValue(e.X).ToString();
    lblYposition.Text = "Pixel Y Position: " + crtPlotData.ChartAreas[0].AxisY.PixelPositionToValue(e.Y).ToString();
    HitTestResult result = crtPlotData.HitTest(e.X, e.Y);
    if (result.PointIndex > -1 && result.ChartArea != null)
    lblXvalue.Text = "X-Value: " + result.Series.Points[result.PointIndex].XValue.ToString();
    lblYvalue.Text = "Y-Value: " + result.Series.Points[result.PointIndex].YValues[0].ToString();
    }...etc.
    The exception occurs at the "lblXposition.Text" statement.
    For whatever reason if the cursor is above the chart at start up I get the error but I don't know how to prevent it long enough for "calculating position of all chart area elements".
    Any help would be appreciated.
    Thanks

    Yet the event DOES work as long as the cursor is not within the chart boundaries at start up.  ???
    It happens to, but I would rely on the documentation. However, you can set a flag to true in the Paint event of the chart, and in the mouseMove handler, exit if the flag has not been set yet.
    Armin

  • Css position:fixed works on mozilla 21/IE10 but not in chrome ?

    Hello guys,
         I want to stick in position  a rectangle or photo while scrolling browser.
    I am using    sym.$("Rectangle3").css({"position":"fixed"});
    This works fine in Mozilla and IE10 but not in chrome (Version 27.0.1453.116 m)
    Anyone to help please?
    Thanks in advance.
    Anthony

    Antony,
    I will defer to what Sarah said.
    In the future if you needed to add browser prefixes to correct differences which happen for a number of things like transform or shapes, etc..
    Or course this will not correct a bug which I was not aware of in this particular case.
    Here is how to add browser prefixes:
    In this case to make an ellipse a circle because chrome did not recognize the ellipse. I added Opera prefix to show you the syntax.
    sym.$('Ellipse').css({
              '-webkit-border-radius': '50%',
              '-o-border-radius': '50%',
              'border-radius': '50%',
              'width': '35px',
              'height': '35px'
    Sometime the syntax is a little different. Just google the css to make sure.
    Here is another example for a Star Wars intro where I added browser prefixes for Explorer (-ms-), Chrome (-webkit-), and Firefox(-moz-).
    The code can be combined but I did not this time for this sample.
    Sample files here:
    https://www.box.com/s/bdu5c4lq67fkfy7blfhc
    // FF
    sym.$('gradient').css('background', '-moz-linear-gradient(top, rgba(0,0,0,1) 0%, transparent 100%)');
    sym.$('container').css('-moz-transform-origin', '50% 100%');
    sym.$('container').css('-moz-transform', 'perspective(250px) rotateX(25deg)');
    // Chrome and others
    sym.$('gradient').css('background', '-webkit-linear-gradient(top, rgba(0,0,0,1) 0%, transparent 100%)');
    sym.$('container').css('-webkit-transform-origin', '50% 100%');
    sym.$('container').css('-webkit-transform', 'perspective(250px) rotateX(25deg)');
    // Internet Explorer
    sym.$('gradient').css('background', '-ms-linear-gradient(top, rgba(0,0,0,1) 0%, transparent 100%)');
    sym.$('container').css('-ms-transform-origin', '50% 100%');
    sym.$('container').css('-ms-transform', 'perspective(250px) rotateX(25deg)');

  • Detecting corners in an image

    I am currently trying to detect the corners in an image using a tecnique called Harruis Corner detector, I am using some code in Matlab to help me do this but it is not working.
    Below I have the code in java and MatLab
    Below is my code in java
    private int[] pixels;
    private int[] grey_scale_image;
    private double[][] greylevels;
    private BufferedImage image;
    private Image result_image;
    private int[] convolvedImage;
    Point[] corners = new Point[100];
    Pixel[][] pixelObjects = new Pixel[256][256];
    int[][][] data;// = new int[][][];
    double[] result223;
    * Constructor for objects of class HarrisCorner
    public HarrisCorner(BufferedImage image) {
    this.image = image;
    int width = image.getWidth();
    int height = image.getHeight();
    pixels = new int[width * height];
    grey_scale_image = new int[pixels.length];
    handlepixels(image, 0, 0, width, height);
    greylevels = new double[width][height];
    for (int j = 0; j < height; j++) {
    for (int i = 0; i < width; i++) {
    greylevels[i][j] = grey_scale_image[j * width + i];
    double[][] kernel = {{-1, 0, 1} , {-1, 0, 1}, {-1, 0, 1}}; // -1 0 1; -1 0 1; -1 0 1 / 3 (look into that)
    // print(kernel);
    System.out.println("\n\n");
    double[][] kernel1 = {{-1, -1, -1} , { 0, 0, 0}, {1, 1, 1}};
    double[][] smooth_kernel = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
    Matrix Ix = new Matrix(convolution2D(greylevels, width, height, kernel,
    kernel.length, kernel[0].length));
    Matrix Iy = new Matrix(convolution2D(greylevels, width, height, kernel1,
    kernel.length, kernel[0].length));
    System.out.println(Ix.getArray().length + " " + Ix.getArray()[0].length);
    System.out.println(Iy.getArray().length + " " + Iy.getArray()[0].length);
    Matrix Ixy = Ix.times(Iy);
    Matrix Ix2 = Ix.times(Ix);
    Matrix Iy2 = Iy.times(Iy);
    Matrix Ixy2 = Ixy.times(Ixy);
    //compute kernel using guassain smoothing operator guassain_kernel()
    Matrix GIx2 = new Matrix(convolution2D(Ix2.getArray(),
    Ix2.getArray().length,
    Ix2.getArray()[0].length,
    guassain_kernel(), smooth_kernel.length,
    smooth_kernel[0].length));
    Matrix GIy2 = new Matrix(convolution2D(Iy2.getArray(),
    Iy2.getArray().length,
    Iy2.getArray()[0].length,
    guassain_kernel(), smooth_kernel.length,
    smooth_kernel[0].length));
    Matrix GIxy2 = new Matrix(convolution2D(Ixy2.getArray(),
    Ixy2.getArray().length,
    Ixy2.getArray()[0].length,
    smooth_kernel, smooth_kernel.length,
    smooth_kernel[0].length));
    //c = (GIx2 + GIy2) - 0.04 * (GIx2 .* GIy2 - GIxy2.^2);
    Matrix M = (Ix2.plus(Iy2)).minus( ( (Ix2.times(Iy2)).minus(Ixy2.times(Ixy2))).times(0.04));
    //Matrix detM = (Ix2.times(Iy2)).minus(Ixy2.times(Ixy2));
    //Matrix traceM = Ix2.plus(Iy2);
    //Matrix M = detM.minus((traceM.times(traceM)).times(0.04));
    // double[] row2 = M.getRowPackedCopy();
    // Arrays.sort(row2);
    // double theCorner = row2[row2.length-100];
    // System.out.println("theCorner" +theCorner);
    // double[][] responses = M.getArray();
    // for(int i = 0; i < responses.length; i++) {
    // for(int j = 0; j < responses[0].length; j++) {
    // if(responses[i][j] <= theCorner)
    // responses[i][j] = 0;
    //double[][] ww = M.getArray();
    double[][] cr22 = wrapBorder(Iy.getArray());
    //double[][] corner_response = wrapBorder(responses);
    result223 = new double[pixels.length];
    for (int j = 0; j < greylevels[0].length; ++j) {
    for (int i = 0; i < greylevels.length; ++i) {
    pixelObjects[i][j].setValues(i,j,cr22[i][j]);
    if(corner_response[i][j] != 0) {
    //cr22[i][j] =
    result223[j * (greylevels.length) + i] = -1;//((Color.red).getRGB());//cr22[i][j];
    else
    result223[j * (greylevels.length) + i] = cr22[i][j];//greylevels[i][j];
    //System.out.println((Color.red).getRGB());
    //scaleAllGray(result223);
    convolvedImage = doublesToValidPixels(result223);
    for (int i = 0; i < corners.length; i++) {
    int index = row2.length - corners.length + i;
    double pixel = row2[index];
    for(int h = 0; h < 256; h++) {
    for(int w = 0; w < 256; w++) {
    Pixel p = pixelObjects[w][h];
    if(p.getPixel() == pixel) {
    corners[i] = new Point(p.getX(),p.getY());
    //if(i==99) break;
    This is the code in Matlab :
    % % HISTORY
    % 2001 Philip Torr ([email protected], [email protected]) at Microsoft
    % Created.
    % Copyright � Microsoft Corp. 2002
    % REF:     "A combined corner and edge detector", C.G. Harris and M.J. Stephens
    %     Proc. Fourth Alvey Vision Conf., Manchester, pp 147-151, 1988.
    %%to do: we might want to make this so it can either take a threshold or a fixed number of corners...
    % c_coord is the n x 2 x,y position of the corners
    % im is the image as a matrix
    % width is the width of the smoothing function
    % sigma is the smoothing sigma
    % subpixel = 1 for subpixel results (not implemented yet)
    %%%%%bugs fixed Jan 2003
    function [c_coord] = torr_charris(im, ncorners, width, sigma, subpixel)
    if (nargin < 2)
    error('not enough input in charris');
    elseif (nargin ==2)
    width = 3; %default
    sigma = 1;
    end
    if (nargin < 5)
    subpixel = 0;
    end
    mask = [-1 0 1; -1 0 1; -1 0 1] / 3;
    % compute horizontal and vertical gradients
    %%note because of the way Matlab does this Ix and Iy will be 2 rows and columns smaller than im
    Ix = conv2(im, mask, 'valid');
    Iy = conv2(im, mask', 'valid');
    % compute squares amd product
    Ixy = Ix .* Iy;
    Ix2 = Ix.^2;
    Iy2 = Iy.^2;
    Ixy2 = Ixy .^2;
    % smooth them
    gmask = torr_gauss_mask(width, sigma);
    %gim = conv2(im, gmask, 'valid');
    %%note because of the way Matlab does this Ix and Iy will be width*2 rows and columns smaller than Ix2,
    % for a total of (1 + width)*2 smaller than im.
    GIx2 = conv2(Ix2, gmask, 'valid');
    GIy2 = conv2(Iy2, gmask, 'valid');
    GIxy2 = conv2(Ixy2, gmask, 'valid');
    % computer cornerness
    % c = (GIx2 + GIy2) ./ (GIx2 .* GIy2 - GIxy2 + 1.0);
    %%%one problem is that this could be negative for certain images.
    c = (GIx2 + GIy2) - 0.04 * (GIx2 .* GIy2 - GIxy2.^2);
    %figure
    %imagesc(c);
    %figure
    %c is smaller than before got border of 2 taken off all round
    %size(c)
    %compute max value around each pixel
    %cmin = imorph(c, ones(3,3), 'min');
    %assuming that the values in c are all positive,
    %this returns the max value at that pixel if it is a local maximum,
    %otherwise we return an arbitrary negative value
    cmax = torr_max3x3(double(c));
    % if pixel equals max, it is a local max, find index,
    ci3 = find(c == cmax);
    cs3 = c(ci3);
    [cs2,ci2] = sort(cs3); %ci2 2 is an index into ci3 which is an index into c
    %put strongest ncorners corners in a list cs together with indices ci
    l = length(cs2)
    lb = max(1,l-ncorners+1);
    cs = cs2(lb:l);
    ci2s = ci2(lb:l);
    ci = ci3(ci2s);
    corn_thresh = cs(1);
    disp(corn_thresh);
    %row and column of each corner
    [nrows, ncols] = size(c);
    %plus four for border
    % c_row = rem(ci,nrows) +4;
    % c_col = ( ci - c_row )/nrows + 1 +4;
    border = 1 + width;
    c_row = rem(ci,nrows) + border;
    c_col = ( ci - c_row +2)/nrows + 1 + border;
    % %to convert to x,y we need to convert from rows to y
    c_coord = [c_col c_row];
    %see Nister's thesis page 19.
    if subpixel
    disp('subpixel not done yet')
    end
    %display corners....
    %hold on
    %          plot(c_col, c_row, '+');
    %          plot(c_coord(:,1), c_coord(:,2), '+');
    % hold off
    %index runs
    % 1 4
    % 2 5\
    % 3 6
    %ci = ci + 4 * nrows + 4;
    %ci = (nrows + 4) * 4 + 4 + ci;
    %c_patches = [gim(ci - nrows) gim(ci - nrows-1) gim(ci - nrows+1) gim(ci-1) gim(ci) gim(ci+1) gim(ci+nrows) gim(ci+nrows+1) gim(ci+nrows-1)];
    % hold on
    %      imagesc(im);
    %          plot(c_col, c_row, 'sw')
    % hold off
    %      size(im)
    %           size(cp)
    %          imr = im2col(im, [5,5])';
    %          im_corr = imr(ci);
    %      im(c_row(:)-1, c_col(:)-1)
    %          each row is a 3x3 matrix
    %      c_patches = [ im(c_row-1, c_col-1) im(c_row-1, c_col) im(c_row-1, c_col+1) ...
    % im(c_row, c_col-1) im(c_row, c_col) im(c_row, c_col+1) ...
    % im(c_row+1, c_col-1) im(c_row+1, c_col) im(c_row+1, c_col+1) ];
    %c_patches = [im(ci-1) im(ci) im(ci+1)];
    %c_patches = [im(ci)];
    Any help would greatly appreciated

    Did you see the button labelled "code" between the subject textfield and the message textarea in the submission form? It allows you to post legible code samples...

  • How to keep roundede corners identical?

    Hello all,
    I was wondering if there was a way of keeping the rounded corners of different sized rounded rectangles the same?
    Now I need to cut the corners I want from one rectangle and paste them over another rectangle with different corners. This works great for rectangles that are larger than the one I cut the corner of, but on smaller rectangles it doesn't work. On those, the original rectangle corners keep being visible ever so slighly.

    That's a bit strange because in a program like Paint Shop Pro it is
    possible.

  • Scale rounded corners

    I love that Photoshop CC has a way to modify rounded corners on rounded rectangles, but when I try to scale the rectangle with the transform tool, the rounded corners keep the same measurements rather than scale in proportion to the rectangle size. Is there an option that I'm overlooking here?

    Just found that if you double click one of the little disks then select your shapes and click "Scale Rectangle Corners" in the "Transform" panel the live corners will scale with the shape...finally...
    I have a creative cloud account because Adobe has assembled a huge suite of other programs but it is their bungled approach to the most basic vector editing features like this that keeps an old copy of CorelDrawX3 on my computer for serious vector editing and exporting to CAD instead of Illustrator...The "add/remove anchor point tools" are such a pain in illustrator compared to the Corel method of making the nodes/anchor points selectable so you can delete or fillet or chamfer them however you want without breaking the shape ...node editing/welding/trimming is much easier/faster in Corel and you can weld/trim/break/round/outline multiple vector objects AT ONCE...oh my...

  • Hot corners keeps forcing my macbook pro to restart.

    I am running Lion OSX 10.8.3 and my computer keeps restarting itself at random times, though I have noticed it the most when I use hot corners. Not every time I use them, but if my computer has been left alone a while and I go to use hot corners it restarts and says the system has crashed. It will also do this at random times while running and operating it normally. It happens occasionally multiple times in a row after hot corners as well. While I am not positive the Hot Corners is the issue, as it seems to recent sometimes without this, it does occur most often immediately when using hot corners. I've reformared and done a clean install and didn't load any of my files back and it still was having the issue. I never had this problem before Lion, it seems Mountain Lion is one of the worst updates so far as I've read others dealin with similar issues.

    Ok, I found the panic report and I can see just how frequently this has occured because there are lots of them from different dates, pretty much every time I've used the computer.
    Thanks for the help, Here is one of two from today:
    Sat Jun  1 11:49:44 2013
    panic(cpu 0 caller 0xffffff7f902fc7f2): NVRM[0/1:0:0]: Read Error 0x00000100: CFG 0xffffffff 0xffffffff 0xffffffff, BAR0 0xd2000000 0xffffff810089d000 0x0a5480a2, D0, P3/4
    Backtrace (CPU 0), Frame : Return Address
    0xffffff810061ad00 : 0xffffff800fa1d626
    0xffffff810061ad70 : 0xffffff7f902fc7f2
    0xffffff810061ae30 : 0xffffff7f903f93b9
    0xffffff810061ae90 : 0xffffff7f903f942e
    0xffffff810061af00 : 0xffffff7f9071fc82
    0xffffff810061b030 : 0xffffff7f9041ffe8
    0xffffff810061b070 : 0xffffff7f90304567
    0xffffff810061b120 : 0xffffff7f9030205a
    0xffffff810061b320 : 0xffffff7f90303983
    0xffffff810061b3f0 : 0xffffff7f91271491
    0xffffff810061b570 : 0xffffff7f9126e687
    0xffffff810061b5f0 : 0xffffff7f9126f4a6
    0xffffff810061b680 : 0xffffff7f9126fa65
    0xffffff810061b7c0 : 0xffffff7f9127053e
    0xffffff810061b8e0 : 0xffffff7f912a3168
    0xffffff810061b920 : 0xffffff7f912a3f05
    0xffffff810061b940 : 0xffffff7f9129dc59
    0xffffff810061bab0 : 0xffffff7f9129e52d
    0xffffff810061baf0 : 0xffffff7f91299de6
    0xffffff810061bb20 : 0xffffff7f91293e85
    0xffffff810061bb50 : 0xffffff7f9127bf24
    0xffffff810061bba0 : 0xffffff800fe65ab3
    0xffffff810061bbc0 : 0xffffff800fe6668d
    0xffffff810061bc20 : 0xffffff800fe6408f
    0xffffff810061bd70 : 0xffffff800fa984a1
    0xffffff810061be80 : 0xffffff800fa20aed
    0xffffff810061beb0 : 0xffffff800fa10448
    0xffffff810061bf00 : 0xffffff800fa1961b
    0xffffff810061bf70 : 0xffffff800faa5dd6
    0xffffff810061bfb0 : 0xffffff800facdd43
          Kernel Extensions in backtrace:
             com.apple.NVDAResman(8.1)[A26D2A3D-C06F-3A0F-BCFF-901A98C93C3D]@0xffffff7f9029f 000->0xffffff7f905acfff
                dependency: com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffff ff7f90076000
                dependency: com.apple.iokit.IONDRVSupport(2.3.7)[38C214C0-83C8-3594-8A4C-DC6AC3FEC163]@0xff ffff7f9028b000
                dependency: com.apple.iokit.IOGraphicsFamily(2.3.7)[74E3E50F-E50A-3073-8C96-06F854292A91]@0 xffffff7f90248000
             com.apple.nvidia.nv50hal(8.1)[5F021999-8B18-3BD5-9B98-90617E638A63]@0xffffff7f9 05ba000->0xffffff7f908dbfff
                dependency: com.apple.NVDAResman(8.1.0)[A26D2A3D-C06F-3A0F-BCFF-901A98C93C3D]@0xffffff7f902 9f000
                dependency: com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffff ff7f90076000
             com.apple.GeForce(8.1)[A15BB65E-3501-340F-87CB-2FD2BAD33E35]@0xffffff7f91240000 ->0xffffff7f9130cfff
                dependency: com.apple.NVDAResman(8.1.0)[A26D2A3D-C06F-3A0F-BCFF-901A98C93C3D]@0xffffff7f902 9f000
                dependency: com.apple.iokit.IONDRVSupport(2.3.7)[38C214C0-83C8-3594-8A4C-DC6AC3FEC163]@0xff ffff7f9028b000
                dependency: com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffff ff7f90076000
                dependency: com.apple.iokit.IOGraphicsFamily(2.3.7)[74E3E50F-E50A-3073-8C96-06F854292A91]@0 xffffff7f90248000
    BSD process name corresponding to current thread: WindowServer
    Mac OS version:
    12D78
    Kernel version:
    Darwin Kernel Version 12.3.0: Sun Jan  6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64
    Kernel UUID: 3EB7D8A7-C2D3-32EC-80F4-AB37D61492C6
    Kernel slide:     0x000000000f800000
    Kernel text base: 0xffffff800fa00000
    System model name: MacBookPro6,2 (Mac-F22586C8)
    System uptime in nanoseconds: 61313730897
    last loaded kext at 33618215469: com.apple.driver.AppleHWSensor 1.9.5d0 (addr 0xffffff7f91adf000, size 36864)
    loaded kexts:
    com.seagate.driver.PowSecLeafDriver_10_5 5.1.1
    com.seagate.driver.PowSecDriverCore 5.1.1
    com.apple.driver.AppleHWSensor 1.9.5d0
    com.apple.iokit.IOBluetoothSerialManager 4.1.3f3
    com.apple.driver.AudioAUUC 1.60
    com.apple.driver.AppleTyMCEDriver 1.0.2d2
    com.apple.driver.AGPM 100.12.87
    com.apple.filesystems.autofs 3.0
    com.apple.driver.AppleMikeyHIDDriver 122
    com.apple.driver.AppleHDAHardwareConfigDriver 2.3.7fc4
    com.apple.iokit.IOUserEthernet 1.0.0d1
    com.apple.driver.AppleHDA 2.3.7fc4
    com.apple.iokit.IOBluetoothUSBDFU 4.1.3f3
    com.apple.driver.AppleMikeyDriver 2.3.7fc4
    com.apple.driver.AppleUpstreamUserClient 3.5.10
    com.apple.iokit.BroadcomBluetoothHCIControllerUSBTransport 4.1.3f3
    com.apple.GeForce 8.1.0
    com.apple.driver.SMCMotionSensor 3.0.3d1
    com.apple.driver.AppleSMCPDRC 1.0.0
    com.apple.driver.AppleSMCLMU 2.0.3d0
    com.apple.Dont_Steal_Mac_OS_X 7.0.0
    com.apple.driver.ApplePolicyControl 3.3.0
    com.apple.driver.AppleLPC 1.6.0
    com.apple.driver.ACPI_SMC_PlatformPlugin 1.0.0
    com.apple.driver.AppleIntelHDGraphics 8.1.0
    com.apple.driver.AppleIntelHDGraphicsFB 8.1.0
    com.apple.driver.AppleMuxControl 3.3.0
    com.apple.nvidia.NVDAStartup 8.1.0
    com.apple.driver.AppleBacklight 170.2.5
    com.apple.driver.AppleMCCSControl 1.1.11
    com.apple.driver.AppleUSBTCButtons 237.1
    com.apple.driver.AppleUSBTCKeyEventDriver 237.1
    com.apple.driver.AppleUSBTCKeyboard 237.1
    com.apple.driver.AppleUSBCardReader 3.1.7
    com.apple.driver.AppleIRController 320.15
    com.apple.driver.AppleFileSystemDriver 3.0.1
    com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1
    com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0d1
    com.apple.BootCache 34
    com.apple.iokit.SCSITaskUserClient 3.5.5
    com.apple.driver.XsanFilter 404
    com.apple.iokit.IOAHCIBlockStorage 2.3.1
    com.apple.driver.AppleUSBHub 5.5.5
    com.apple.driver.AirPort.Brcm4331 614.20.16
    com.apple.driver.AppleAHCIPort 2.5.1
    com.apple.driver.AppleFWOHCI 4.9.6
    com.apple.iokit.AppleBCM5701Ethernet 3.6.0b1
    com.apple.driver.AppleUSBEHCI 5.5.0
    com.apple.driver.AppleUSBUHCI 5.2.5
    com.apple.driver.AppleEFINVRAM 1.7
    com.apple.driver.AppleSmartBatteryManager 161.0.0
    com.apple.driver.AppleRTC 1.5
    com.apple.driver.AppleACPIButtons 1.7
    com.apple.driver.AppleHPET 1.8
    com.apple.driver.AppleSMBIOS 1.9
    com.apple.driver.AppleACPIEC 1.7
    com.apple.driver.AppleAPIC 1.6
    com.apple.driver.AppleIntelCPUPowerManagementClient 196.0.0
    com.apple.nke.applicationfirewall 4.0.39
    com.apple.security.quarantine 2
    com.apple.driver.AppleIntelCPUPowerManagement 196.0.0
    com.apple.iokit.IOSerialFamily 10.0.6
    com.apple.kext.triggers 1.0
    com.apple.driver.DspFuncLib 2.3.7fc4
    com.apple.iokit.IOAudioFamily 1.8.9fc11
    com.apple.kext.OSvKernDSPLib 1.6
    com.apple.iokit.IOSurface 86.0.4
    com.apple.iokit.AppleBluetoothHCIControllerUSBTransport 4.1.3f3
    com.apple.iokit.IOBluetoothFamily 4.1.3f3
    com.apple.driver.AppleSMBusPCI 1.0.11d0
    com.apple.nvidia.nv50hal 8.1.0
    com.apple.NVDAResman 8.1.0
    com.apple.iokit.IOFireWireIP 2.2.5
    com.apple.driver.AppleHDAController 2.3.7fc4
    com.apple.iokit.IOHDAFamily 2.3.7fc4
    com.apple.driver.AppleSMC 3.1.4d2
    com.apple.driver.IOPlatformPluginLegacy 1.0.0
    com.apple.driver.IOPlatformPluginFamily 5.3.0d51
    com.apple.driver.AppleGraphicsControl 3.3.0
    com.apple.driver.AppleBacklightExpert 1.0.4
    com.apple.iokit.IONDRVSupport 2.3.7
    com.apple.driver.AppleSMBusController 1.0.11d0
    com.apple.iokit.IOGraphicsFamily 2.3.7
    com.apple.driver.AppleUSBMultitouch 237.3
    com.apple.iokit.IOUSBMassStorageClass 3.5.1
    com.apple.iokit.IOUSBHIDDriver 5.2.5
    com.apple.driver.AppleUSBMergeNub 5.5.5
    com.apple.driver.AppleUSBComposite 5.2.5
    com.apple.iokit.IOSCSIMultimediaCommandsDevice 3.5.5
    com.apple.iokit.IOBDStorageFamily 1.7
    com.apple.iokit.IODVDStorageFamily 1.7.1
    com.apple.iokit.IOCDStorageFamily 1.7.1
    com.apple.iokit.IOFireWireSBP2 4.2.2
    com.apple.iokit.IOSCSIBlockCommandsDevice 3.5.5
    com.apple.iokit.IOAHCISerialATAPI 2.5.1
    com.apple.iokit.IOSCSIArchitectureModelFamily 3.5.5
    com.apple.iokit.IO80211Family 522.4
    com.apple.iokit.IOUSBUserClient 5.5.5
    com.apple.iokit.IOAHCIFamily 2.3.1
    com.apple.iokit.IOFireWireFamily 4.5.5
    com.apple.iokit.IOEthernetAVBController 1.0.2b1
    com.apple.iokit.IONetworkingFamily 3.0
    com.apple.iokit.IOUSBFamily 5.5.5
    com.apple.driver.AppleEFIRuntime 1.7
    com.apple.iokit.IOHIDFamily 1.8.1
    com.apple.iokit.IOSMBusFamily 1.1
    com.apple.security.sandbox 220.2
    com.apple.kext.AppleMatch 1.0.0d1
    com.apple.security.TMSafetyNet 7
    com.apple.driver.DiskImages 345
    com.apple.iokit.IOStorageFamily 1.8
    com.apple.driver.AppleKeyStore 28.21
    com.apple.driver.AppleACPIPlatform 1.7
    com.apple.iokit.IOPCIFamily 2.7.3
    com.apple.iokit.IOACPIFamily 1.4
    com.apple.kec.corecrypto 1.0

  • Pause in blend motion routine

    I am using a blend motion routine (derived from the example that ships with the board) to blend 3 sets of x-y points on two axes on a PCI-7344. The rountine works great except when I ask for movement in only the x direction or only the y direction. In both cases there can be pauses of 3 seconds or more between blend moves. If I have movement in the x and y direction, then there is never a pause. Why would this occur? For example if I am at 0,0 and the next set of points to belnd through is 100,0, then I will get a pause. However, if I the next point is 100,100, then there will be no pause. The stepper motors are being run closed loop at 10,000 steps/rev with 10,000 counts/rev on the encoders.

    With blend factor 0 the axes decelerate to a stop and start the next move immediately after that. With blend factor -1 the acceleration phase of the next move starts as soon as the deceleration phase of the first move begins. In this case the axes don't stop between each move which is the main reason why blending is used. The disadvantage of this method is the fact that corners in the move profiles get rounded. The degree of this rounding depends on the acceleration/deceleration values.
    Here is one possible scenario why the wait occurrs:
    A short move is executed and during this move you load new trajectory parameters but this process isn't finished by the time you send the new blend command. In this case the move decelerates to a stop. In thi
    s case the 7344 tries to reach exactly the target position you have specified for the move. As the resolution of your encoder is very high there is a good chance that the target position isn't reached exactly. Thus the board starts some pull-in moves until the position is reached (by default after three pull-in moves the board gives up). If your program would have been able to send the next blend command fast enough this sequence would have been skipped.
    The pull-in moves are only executed when there is a difference between the encoder position and the calculated position. Thus they are only executed in closed loop systems.
    Possible solutions:
    1. Configure the "Move Complete Criteria" in the axes' trajectory settings in MAX to accept some displacement (deadband parameter)
    2. Reduce the velocity for short moves or don't use very short travel ranges at all (this might not be possible).
    3. If nothing of this helps or don't use blending at all. Use buffered contouring
    instead (please refer to the shipping examples).
    Best regards.
    Jochen
    NI-Germany

  • Problem in a drawing program

    Dear experts,
    While working on a program,i am having a problem which is just killing me.This is a simple drawing program.On clicking draw button,user
    can do free hand drawing.On clicking line he can stretch line to any
    coordinate.Similarily do erasing etc.
    Problem underlies in rectangle part.I am using some conditions.
    Conditions are based on analysis.Fixx and Fixy are the points
    when mouse is pressed.
    Prevx and Prevy are coordinates which are stored before retrieving
    newer ones.x and y are new coordinates.
    I have marked the relevant code as part of code for easy understanding.
    Problem is in behaviour for rectangle.If i draw twoards either side
    it works well but the moment i drag right ,left,up down ,i get
    patched near origin(fixed point) from where mouse was pressed ie
    fixx,fixy.
    I recommend if this could be copied as it is and run,the problem will come to light better.
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.util.*;
    public class FProf extends JPanel implements MouseListener,ActionListener,MouseMotionListener
    JFrame main_window;
    int draw_mode,erase_mode,line_mode,box_mode;
    double fixx,fixy;
    double initx,inity;
    double x,y;
    JButton b_draw;
    JButton b_erase;
    JButton b_line;
    JButton b_rec;
    JPanel draw_panel;
    JPanel bt_panel;
    Graphics2D g2;
    Point p;//Mouse pointer
    Image image=null;
    double prevx,prevy;
    double c1,c2,c3,c4,c5,c6,c7,c8;
    Stroke[] linestyles = new Stroke[] {
    new BasicStroke(25.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL),
    new BasicStroke(25.0f, BasicStroke.CAP_SQUARE,BasicStroke.JOIN_MITER),
    new BasicStroke(1.0f, BasicStroke.CAP_ROUND,BasicStroke.JOIN_MITER),
    new BasicStroke(25.0f, BasicStroke.CAP_ROUND,
    BasicStroke.JOIN_ROUND), };
    FProf()
    draw_mode=0; //Inactive
    erase_mode=0; //Inactive
    addMouseListener(this);
    addMouseMotionListener(this);
    GridLayout l=new GridLayout(4,4);
    main_window=new JFrame("Fountain Prof V.200");
    bt_panel=new JPanel();
    b_draw=new JButton ("Draw");
    b_draw.addActionListener(this);
    b_erase=new JButton("Erase");
    b_erase.addActionListener(this);
    b_line=new JButton("Line");
    b_line.addActionListener(this);
    b_rec=new JButton ("Box");
    b_rec.addActionListener(this);
    main_window.getContentPane().setLayout(new BorderLayout());
    main_window.getContentPane().add("Center",this);
    bt_panel.setLayout(l);
    bt_panel.add(b_draw);
    bt_panel.add(b_erase);
    bt_panel.add(b_line);
    bt_panel.add(b_rec);
    main_window.getContentPane().add("East",bt_panel);
    main_window.setSize(800,600);
    main_window.show();
    private void draw()
    if ((erase_mode==1) &&(draw_mode==0) &&(line_mode==0)&&(box_mode==0)) {
    g2.setPaintMode();
    g2.setColor(Color.white);
    g2.setStroke(linestyles[3]); // Select the line style to use
    g2.draw(new Line2D.Double(initx,inity,x,y));
    repaint();
    else if ((draw_mode==1) && (line_mode==0) &&(erase_mode==0)&&(box_mode==0))
    g2.setPaintMode();
    g2.setColor(Color.black);
    g2.setStroke(linestyles[2]); // Select the line style to use
    g2.draw(new Line2D.Double(initx,inity,x,y));
    repaint();
    else if ((draw_mode==0) && (erase_mode==0) &&(line_mode==1)&&(box_mode==0))
    repaint();
            else if ((draw_mode==0) && (erase_mode==0) &&(line_mode==0)&&(box_mode==1))
            repaint();
    public void paintComponent(Graphics g)
    super.paintComponent(g);
    if (image == null)
    System.out.print(getHeight());
    g2=(Graphics2D) g;
    image = createImage(getWidth(), getHeight());
    g2 = (Graphics2D)image.getGraphics();
    g2.setColor(Color.white);
    g2.fillRect(0, 0, getWidth(), getHeight());
    g2.setColor(Color.black);
    Rectangle r = g.getClipBounds();
    g.drawImage(image, r.x, r.y, r.width+r.x, r.height+r.y, r.x, r.y, r.width+r.x, r.height+r.y, null);
    public void mouseReleased(MouseEvent e)
    public void mouseEntered(MouseEvent e)
    public void mouseExited(MouseEvent e)
    public void change_cursor()
    Toolkit tk=Toolkit.getDefaultToolkit();
    if ((draw_mode==1)&&(erase_mode==0)) {
    Image img=tk.getImage("Pen.gif");
    Cursor dym=tk.createCustomCursor(img,new Point(10,10),null);
    setCursor(dym);
    else if ((erase_mode==1)&&(draw_mode==0)) {
    Image img=tk.getImage("eraser.gif");
    Cursor dym=tk.createCustomCursor(img,new Point(10,10),null);
    setCursor(dym);
    public void mouseClicked(MouseEvent e)
    public void mouseDragged(MouseEvent e)
    Point p;
    if ((draw_mode ==1)||(erase_mode==1)) {
    initx=x;inity=y;
    p=e.getPoint();
    x=p.getX();
    y=p.getY();
    draw();
    if ((line_mode==1)&&(box_mode==0)) {
    if (mousehasmoved(e)) {
    prevx=x;prevy=y;
    p=e.getPoint();
    x=p.getX();
    y=p.getY();
    g2 = (Graphics2D)image.getGraphics();
    g2.setColor(Color.black);
    g2.setXORMode(Color.white);
    g2.draw(new Line2D.Double(fixx,fixy,prevx,prevy)); //erasing previous line
    draw();
    g2.draw(new Line2D.Double(fixx,fixy,x,y)); //redrawing newer one
    draw();
    if ((line_mode==0)&&(box_mode==1)) {
    if (mousehasmoved(e)) {
    prevx=x;prevy=y;
    p=e.getPoint();
    x=p.getX();
    y=p.getY();
    g2 = (Graphics2D)image.getGraphics();
    g2.setColor(Color.black);
    g2.setXORMode(Color.white);
    if ((x<=fixx) && (y>=fixy)) {
    c1=x;c2=fixy;c3=fixx-x;c4=y-fixy;c5=prevx;c6=fixy;c7=fixx-prevx;c8=prevy-fixy;
    else if ((x>=fixx)&&(y>=fixy)) {
    c1=fixx;c2=fixy;c3=x-fixx;c4=y-fixy;c5=fixx;c6=fixy;c7=prevx-fixx;c8=prevy-fixy;
    else if ((x>=fixx)&&(y<=fixy)) {
    c1=fixx;c2=y;c3=x-fixx;c4=fixy-y;c5=fixx;c6=prevy;c7=prevx-fixx;c8=fixy-prevy;
    else if ((x<=fixx)&&(y<=fixy)) {
    c1=x;c2=y;c3=fixx-x;c4=fixy-y;c5=prevx;c6=prevy;c7=fixx-prevx;c8=fixy-prevy;
    g2.draw(new  Rectangle2D.Double(c5,c6,c7,c8));
    draw();
    g2.draw(new  Rectangle2D.Double(c1,c2,c3,c4));
    draw();
    }public void mouseMoved(MouseEvent e)
    p=e.getPoint();
    x=p.getX();
    y=p.getY();
    main_window.setTitle("X- "+x+" "+"Y- "+y);
    initx=x;inity=y; //Get me current position
    if ((draw_mode==1)||(erase_mode==1)) {
    //change_cursor();
    else {
    setCursor(Cursor.getDefaultCursor());
    public void mousePressed(MouseEvent ex)
    if ((draw_mode==0) && (erase_mode==0) &&((line_mode==1)||(box_mode==1))) {
    fixx=ex.getX();fixy=ex.getY();
    public void actionPerformed(ActionEvent ev)
    Object ob=ev.getSource();
    if (ob==b_draw) {
    draw_mode=1;erase_mode=0;line_mode=0;
    box_mode=0;
    if (ob==b_erase) {
    erase_mode=1;draw_mode=0;line_mode=0;
    box_mode=0;
    if (ob==b_line) {
    erase_mode=0;draw_mode=0;line_mode=1;
    box_mode=0;
    if (ob==b_rec) {
    erase_mode=0;draw_mode=0;line_mode=0;box_mode=1;
    public static void main(String args[])
    new FProf();
    public boolean mousehasmoved (MouseEvent e)
    return((initx != e.getX()) ||(inity!=e.getY()));
    }}

    change your mouseDragged method to something like:
        public void mouseDragged(MouseEvent e)
            Point p;
            if ((draw_mode == 1) || (erase_mode == 1))
                initx = x;
                inity = y;
                p = e.getPoint();
                x = p.getX();
                y = p.getY();
                draw();
            if ((line_mode == 1) && (box_mode == 0))
                if (mousehasmoved(e))
                    prevx = x;
                    prevy = y;
                    p = e.getPoint();
                    x = p.getX();
                    y = p.getY();
                    g2 = (Graphics2D) image.getGraphics();
                    g2.setColor(Color.black);
                    g2.setXORMode(Color.white);
                    g2.draw(new Line2D.Double(fixx, fixy, prevx, prevy)); // erasing
                                                                            // previous
                                                                            // line
                    draw();
                    g2.draw(new Line2D.Double(fixx, fixy, x, y)); // redrawing
                                                                    // newer one
                    draw();
            if ((line_mode == 0) && (box_mode == 1))
                if (mousehasmoved(e))
                    prevx = x;
                    prevy = y;
                    p = e.getPoint();
                    x = p.getX();
                    y = p.getY();
                    g2 = (Graphics2D) image.getGraphics();
                    g2.setColor(Color.black);
                    g2.setXORMode(Color.white);
                     * calculate the former rectangle - it does not depend to
                     * the new rectangle!
                    if((prevx <= fixx) && (prevy >= fixy))
                        c5 = prevx;
                        c6 = fixy;
                        c7 = fixx - prevx;
                        c8 = prevy - fixy;                   
                    else
                        if ((prevx >= fixx) && (prevy >= fixy))
                            c5 = fixx;
                            c6 = fixy;
                            c7 = prevx - fixx;
                            c8 = prevy - fixy;
                        else
                            if ((prevx >= fixx) && (prevy <= fixy))
                                c5 = fixx;
                                c6 = prevy;
                                c7 = prevx - fixx;
                                c8 = fixy - prevy;
                            else
                                if ((prevx <= fixx) && (prevy <= fixy))
                                    c5 = prevx;
                                    c6 = prevy;
                                    c7 = fixx - prevx;
                                    c8 = fixy - prevy;
                     * calculate the new rectangle here
                    if ((x <= fixx) && (y >= fixy))
                        c1 = x;
                        c2 = fixy;
                        c3 = fixx - x;
                        c4 = y - fixy;
                    else
                        if ((x >= fixx) && (y >= fixy))
                            c1 = fixx;
                            c2 = fixy;
                            c3 = x - fixx;
                            c4 = y - fixy;
                        else
                            if ((x >= fixx) && (y <= fixy))
                                c1 = fixx;
                                c2 = y;
                                c3 = x - fixx;
                                c4 = fixy - y;
                            else
                                if ((x <= fixx) && (y <= fixy))
                                    c1 = x;
                                    c2 = y;
                                    c3 = fixx - x;
                                    c4 = fixy - y;
                    g2.draw(new Rectangle2D.Double(c5, c6, c7, c8));
                    draw();
                    g2.draw(new Rectangle2D.Double(c1, c2, c3, c4));
                    draw();
        }why?
    You calculated the former rectangle in dependence to the newly created one. It does not depend on that, but needs its own if statements. I'm sure you will understand what I mean when looking at the method.

  • Debit Memo Request Issue

    Dear friends,
    The copy controls are set for  a) Sales Order to Debit memo request (VTAA) & b) Billing to Debit Memo Request (VTAF)
    Scenario #1. Sales Order Qty  is 10 No (Delivery and Billing done for 10 Nos) and I have created a DMR for qty 5 Nos with reference to the sales order  and created the Debit Memo.
    Now when I create one more DMR with reference to the same sales order, the qty referenced in the DMR is 15 No
    Scenario #2. Sales Order Qty  is 10 No (Delivery and Billing done for 10 Nos) and I have created a DMR for qty 5 Nos with reference to the Billing doc and created the Debit Memo.
    Now when I create one more DMR with reference to the same Billing doc, the qty referenced in the DMR is 10 No
    1. While creating a Credit Memo Request or Debit Memo request whats the standard reference document to be used? Is it Sales order or a Billing doc?
    2. I have tested this using standard doc types and I think this is not the correct behaviour.
    In both the scenarios, the referenced qty should be 5No when you are creating the DMR for the second time.
    Somebody let me know what should be the Ideal way to do it......
    Thanks
    Isaac

    Hi Isaac,
    In transaction code VTAA goto OR to DR  and look for your Item Category and in that there is a field by name Pos./neg. quantity
    and in that you will find the help details as shown below:
    The below details will help you for all the documents like Quotatio, Sales Order , billing etc.
    Quantity is calculated positively, negatively or not at all                                                                               
    Indicates whether, during copying, the quantity or value in the target  
         document has a negative effect, positive effect, or no effect at all on 
         the quantity still to be completed in the source document.                                                                               
    Use                                                                               
    The system uses this indicator to determine how the quantity in the     
         source document is affected. For example, if you                                                                               
    o   Create a quotation item for 100 pieces,                                                                               
    o   Copy the quotation into a sales order, and                                                                               
    o   Create a sales order item for 80 pieces,                                                                               
    the copying has a positive effect on the quotation. In effect, you have 
         added 80 pieces to the quotation quantity that is now considered        
         complete. 20 pieces in the quotation remain to be completed.            
      If you do not make an entry in this field, or set indicator 0, the     
      source document is not blocked, which allows you to create several     
      target documents at once (for example, when using EDI and frequent     
      contract releases).                                                                               
    While the source document (such as quotation or quantity contract) is  
      being processed, it is blocked. For instance, if you are working on a  
      quantity contract, no one can create a release order for that contract).
                                                                                    In sales documents, for example, you can expect the following results: 
    o   Quotation   -> Sales order: positive                                                                               
    o   Contract    -> Return: negative                                                                               
    o   Sales order -> Sales order: no effect                                                                               
    In billing documents, for example, you can expect the following results:
    o   Delivery    -> Invoice: positive                                                                               
    o   Delivery    -> Cancellation: negative                                                                               
    o   Delivery    -> Pro-forma invoice: no effect         
    Regards

  • Image Resolution Question 150dpi vs 300dpi in Final Layout

    In the final offset color printing of a file, does it make a difference if the images in the document are 150 dpi or 300 dpi? I know they shouldn't be less than 150, but does making them higher dpi make them really better? Or does it just make the file larger? If you think it does make the image better, please let me know why. I'd be particulary interested to hear from someone who works with a printing house. Or if there is something on Adobe's website addressing this issue, please add the link.
    Thank you,
    Marilyn

    Yes, it does make a difference.
    These numbers do not come out of the blue. A typical laser photosetter has an output resolution of 2400 dpi [*]. Each of the halftone dots that make up halftone images can be one of 256 values of gray (a hardcoded PostScript limitation). That would make the absolute minimum size of each dot 16 x 16 output pixels. 2400 divided by 16 is 150, hence, you can fit 150 complete halftone dots across an inch.
    However, the calculated position of the halftone dots does not take the actual photosetter halftone position in account (your image may not start at exactly the internal start of a halftone dot). Each of your single dots may be broken into two because they may not be "aligned" with the dots the output device produces. So, on every relatively sharp color boundary of two input pixels (which are output as exactly 2 output halftone dots), the color of this dot will be rounded to both the left and right input pixel (and upper and lower one).
    Doubling the input resolution means than more than a single input pixel is taken into account per halftone dot (of which at least one will be entirely inside the dot), smoothing things out.
    There is also an upper limit on which it will not matter anymore whether you throw in more input pixels per halftone dot -- the typical upper useful value used by InDesign and Distiller is 450 dpi -- images above this are downsampled to 300 dpi, so (apparently) the difference between 300 and 450 dpi is neglectable.
    [*] Modern machines may advertise a higher resolution, even upwards of 3000 dpi, but it's at the operators discretion to switch back to a lower rez to save time and memory -- and no skilled operator will (or should) go below 2400 dpi for halftone images.

  • THE ULTIMATE IRONY!

    Hello everybody...
    check out the copy below...
    this is how ADOBE describe FREEHAND on THIS website...pretty amazing eh!
    This poses the question to me, why not practice what you preach adobe! why don't you take a leaf out of your own (or macromedia's) book?... unbelievable!
    I just find it hilarious how adobe can describe freehand on this website so perfectly and so true to life, i.e brilliant!, but then try to kill it a slow painful death at the same time...
    THIS IS EXACTLY WHY WE USE FREEHAND ADOBE!...AND NEED IT TO HAVE A FUTURE!
    http://www.adobe.com/products/freehand/productinfo/overview/
    FreeHand MX at a glance
    The creative design solution for print, Internet, and Adobe Flash
    Realize your creative vision with an unparalleled set of creative design tools. ONLY FreeHand® MX has everything you need to move seamlessly from concept through design, production, and publishing in a streamlined graphics environment — all while working with a single document. Use FreeHand MX for storyboarding, creative design, multipage document production, and editing. Whether you're designing for print, the Internet, or Adobe® Flash®, you can repurpose your FreeHand MX projects across multiple mediums quickly and efficiently.
    EASY
    Quickly go from concept to design and publishing in print, Internet, and Flash projects. FreeHand MX provides a streamlined, easy-to-learn graphics environment for designing illustrations, organizing information, laying out storyboards, and developing click-through presentations.
    Enhance productivity with a highly customizable workspace. The Object panel eliminates the need to move between multiple panels to inspect and change object, text, and style properties. Tools panel organization and a streamlined workflow make FreeHand MX easy to learn and use.
    Quickly organize and map navigation, content, components, and data flows. Drag and drop to build persistent relationships between objects — while providing complete editability of stroke styles — with the Connector Lines tool. Achieve maximum editability and reduce production and revision times using master pages and backgrounds, Symbol libraries of data types and navigation components, and the graphics-based Find & Replace panel.
    Produce immersive presentations and click-throughs for proof-of-concept proposals and client approvals. Drag and drop interactivity between objects and pages with the Action tool. Assign ActionScript™ commands in the easy-to-use Navigation panel. Quickly publish to SWF format for easy distribution.
    POWERFUL
    Rapidly create and edit visually rich designs and illustrations that provide maximum impact. FreeHand MX includes a powerful and flexible set of vector-based tools for designing print layouts, animations in Flash, or application interfaces.
    Layer complex visual appearances on individual vector objects. With multiple attributes you can apply and organize an unlimited number of strokes, fills, and effects on a single object, from a single panel — eliminating the need to keep up with and edit multiple copies of an object for the same visual appearance.
    Easily build rich graphical components for ads, interface objects, and attention-grabbing headlines. Apply path manipulation effects such as bend and transform while maintaining editability of the original shape with live vector effects. Provide high-resolution, realistic appearances — such as drop shadow and bevel — with live raster effects. Create 3D appearances with the Extrude tool.
    Quickly reshape graphic primitives while maintaining editability. Round rectangle corners, turn ovals into arcs, and change the number of points on stars — all within the workspace.
    WHAT A READ EH! MAYBE ADOBE SHOULD READ THIS....
    I wonder how long it is before adobe change the description of freehand on this website??
    thanks,
    mark f

    This discussion is not appropriate for the Design forum.

Maybe you are looking for

  • Whether I could create a inv report with "Last Contact"

    Hi All My customer wnat to a method to easy list all worlkstation that did not contact from special date...Because inventory Scan & upload in not every day..So I could not use these data attributes..but it seem that no "last contract" attributes in Z

  • 1080p pour export quality for 25p material from Canon HF100 PAL

    Hi I have now tested iMovie 11 with a Canon HF100 PAL version. Shooting in progressive. The AIC import has good quality. New 1080p export gives same pour quality as before when using QuickTime 7 for h.264 export. AIC export provides good quality. So

  • "Today" smart Mail folder filters for wrong date

    Hi The Today smart folder in Mail is set to show today's messages, but is showing messages dated August 8 instead. I only got my MacBook Air yesterday and it's my first Mac, but I'm computer-literate so I checked the date setting and it's correct. I'

  • Faulty touch screen

    Ok, so i bought a new ipod touch on the weekend which was 5 days ago. It was working well until my ipod decided not to work and to turn off. I was searching to see if my ipod had some how gotten water damage as i use it when excercising and i noticed

  • New Macbook vs. TV

    I have the newest Apple 13 inch 2 GHz. I want to connect it to my Sony 52" Bravia TV (trying to keep the economy going). To that end I bought a Mini DVI connector from Apple as well as Monster audo cables. In addition I bought a DVI to HDMI cable to